Documentation
¶
Overview ¶
Package refl wraps some reflection functionalities
Index ¶
- type Channel
- type ChannelType
- type Function
- func (fn *Function) ArgChannelType(argNum int) ChannelType
- func (fn *Function) AssertNumberOfArguments(num int)
- func (fn *Function) RunAsEndGoroutine(inCh Channel, releaseFunc func())
- func (fn *Function) RunAsMiddleGoroutine(input, output Channel, releaseFunc func())
- func (fn *Function) RunAsStartGoroutine(output Channel, releaseFunc func())
- func (fn *Function) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelType ¶
type ChannelType struct {
// contains filtered or unexported fields
}
ChannelType wraps a channel type
func (*ChannelType) AssertCanSendTo ¶
func (ch *ChannelType) AssertCanSendTo(dst ChannelType)
func (*ChannelType) CanReceive ¶
func (ch *ChannelType) CanReceive() bool
func (ChannelType) CanSend ¶
func (ch ChannelType) CanSend() bool
func (ChannelType) ElemType ¶ added in v0.1.1
func (ch ChannelType) ElemType() reflect.Type
func (*ChannelType) Instantiate ¶
func (ch *ChannelType) Instantiate(bufLen int) Channel
type Function ¶
Function wraps a reflect.Value and provides some common reflective assertions about its type
func WrapFunction ¶
func WrapFunction(fn interface{}) Function
WrapFunction wraps a provided function into a refl.Function object. It panics if the provided argument is not a function.
func (*Function) ArgChannelType ¶
func (fn *Function) ArgChannelType(argNum int) ChannelType
ArgChannelType returns the type of the channel in the numbered argumment. It panics if the argument in that position is not a channel
func (*Function) AssertNumberOfArguments ¶
AssertNumberOfArguments panics if the function does not have the given number of arguments
func (*Function) RunAsEndGoroutine ¶
RunAsEndGoroutine runs in a goroutine a func(in <-chan T) instance. It accepts a Channel to be used as input for data. The releaseFunc will be invoked when the wrapped function ends.
func (*Function) RunAsMiddleGoroutine ¶
RunAsMiddleGoroutine runs in a goroutine a func(in <-chan T, out chan<- U) instance. It accepts two Channel to be used as input and output for the data. When the executed function is finished, the releaseFunc method is invoked.
func (*Function) RunAsStartGoroutine ¶
RunAsStartGoroutine runs in a goroutine a func(out chan<- T) instance. It accepts a Channel where the data will be sent. The releaseFunc will be invoked when the wrapped function ends.