pipe

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAnyChannelBuff

func MakeAnyChannelBuff(cap int) (out anyThingChannel)

MakeAnyChannelBuff returns a new open buffered channel with capacity `cap`.

func MakeAnyChannelChan

func MakeAnyChannelChan() (out anyThingChannel)

MakeAnyChannelChan returns a new open channel (simply a 'chan Any' that is).

Note: No 'Any-producer' is launched here yet! (as is in all the other functions).
This is useful to easily create corresponding variables such as:

  var myAnyPipelineStartsHere := MakeAnyChan()
  // ... lot's of code to design and build Your favourite "myAnyWorkflowPipeline"
  // ...
  // ... *before* You start pouring data into it, e.g. simply via:
  for drop := range water {
      myAnyPipelineStartsHere <- drop
  }
  close(myAnyPipelineStartsHere)

Hint: especially helpful, if Your piping library operates on some hidden (non-exported) type
(or on a type imported from elsewhere - and You don't want/need or should(!) have to care.)

Note: as always (except for PipeAnyBuffer) the channel is unbuffered.

Types

type AnyChanCore

type AnyChanCore interface {
	Close()
	Len() int
	Cap() int
}

AnyChanCore represents basic methods common to every channel of Any elements

type AnyDemand

type AnyDemand struct {
	// contains filtered or unexported fields
}

AnyDemand is a demand channel

func MakeAnyDemandBuff

func MakeAnyDemandBuff(cap int) *AnyDemand

MakeAnyDemandBuff returns a (pointer to a) fresh buffered (with capacity=`cap`) demand channel

func MakeAnyDemandChan

func MakeAnyDemandChan() *AnyDemand

MakeAnyDemandChan returns a (pointer to a) fresh unbuffered demand channel

func (*AnyDemand) Cap

func (c *AnyDemand) Cap() int

Cap reports the capacity of the underlying anyThing channel

func (*AnyDemand) Close

func (c *AnyDemand) Close()

Close closes the underlying anyThing channel

func (*AnyDemand) Len

func (c *AnyDemand) Len() int

Len reports the length of the underlying anyThing channel

func (*AnyDemand) Provide

func (c *AnyDemand) Provide(dat anyThing)

Provide is the send method - aka "myAnyChan <- myAny"

func (*AnyDemand) Receive

func (c *AnyDemand) Receive() (dat anyThing)

Receive is the receive operator as method - aka "myAny := <-myAnyChan"

func (*AnyDemand) Request

func (c *AnyDemand) Request() (dat anyThing, open bool)

Request is the comma-ok multi-valued form of Receive and reports whether a received value was sent before the anyThing channel was closed

type AnyProvider

type AnyProvider interface {
	AnyChanCore // close, len & cap
	// contains filtered or unexported methods
}

AnyProvider represents a send-enabled channel of anyThing elements - aka `chan<-`

type AnyReceiver

type AnyReceiver interface {
	AnyChanCore // close, len & cap
	// contains filtered or unexported methods
}

AnyReceiver represents a receive-only channel of anyThing elements - aka `<-chan`

type AnySupply

type AnySupply struct {
	// contains filtered or unexported fields
}

AnySupply is a supply channel

func MakeAnySupplyBuff

func MakeAnySupplyBuff(cap int) *AnySupply

MakeAnySupplyBuff returns a (pointer to a) fresh buffered (with capacity=`cap`) supply channel

func MakeAnySupplyChan

func MakeAnySupplyChan() *AnySupply

MakeAnySupplyChan returns a (pointer to a) fresh unbuffered supply channel

func (*AnySupply) Cap

func (c *AnySupply) Cap() int

Cap reports the capacity of the underlying anyThing channel

func (*AnySupply) Close

func (c *AnySupply) Close()

Close closes the underlying anyThing channel

func (*AnySupply) Len

func (c *AnySupply) Len() int

Len reports the length of the underlying anyThing channel

func (*AnySupply) Provide

func (c *AnySupply) Provide(dat anyThing)

Provide is the send method - aka "myAnyChan <- myAny"

func (*AnySupply) Receive

func (c *AnySupply) Receive() (dat anyThing)

Receive is the receive operator as method - aka "myAny := <-myAnyChan"

func (*AnySupply) Request

func (c *AnySupply) Request() (dat anyThing, open bool)

Request is the comma-ok multi-valued form of Receive and reports whether a received value was sent before the anyThing channel was closed

Jump to

Keyboard shortcuts

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