Pudu programming language
Menu
API reference

Std.Channel.channel

1 declaration

fn

channel: Int -> Std.Channel.Channel[T]

This is a callable function.

What it does

A channel holding at most the given count of items.

The bound is what makes a channel apply back-pressure: a sender waits when

the channel is full, so a fast producer is slowed to the speed of its

consumer rather than turning the difference into memory. A queue without a

bound does not remove that problem, it postpones it until there is no

memory left.

A bound below one is taken as one. A channel with no room could never be

sent to, and a caller writing zero meant the smallest useful channel rather

than one that stops the program.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • Names inside [ ] are type arguments, such as the item type held by a collection.

Back to Std.ChannelSearch related declarations