refl

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package refl wraps some reflection functionalities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	reflect.Value
}

Channel wraps a channel for its usage with refl.Function objects

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

type Function reflect.Value

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

func (fn *Function) AssertNumberOfArguments(num int)

AssertNumberOfArguments panics if the function does not have the given number of arguments

func (*Function) RunAsEndGoroutine

func (fn *Function) RunAsEndGoroutine(inCh Channel, releaseFunc func())

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

func (fn *Function) RunAsMiddleGoroutine(input, output Channel, releaseFunc func())

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

func (fn *Function) RunAsStartGoroutine(output Channel, releaseFunc func())

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.

func (*Function) String

func (fn *Function) String() string

String representation of the Function type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL