Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero authored Nov 24, 2024
1 parent ece24c7 commit 10df303
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ ChannelQueue also supports circular buffer behavior when created using `NewRing`

When specifying an unlimited buffer capacity use caution as the buffer is still limited by the resources available on the host system.

The ChannelQueue buffer auto-resizes according to the number of items buffered. For more information on the queue, see: https://github.com/gammazero/deque
The ChannelQueue buffer auto-resizes according to the number of items buffered. For more information on the internal queue, see: https://github.com/gammazero/deque

ChannelQueue uses generics to contain items of the type specified. To create a ChannelQueue that holds a specific type, provide a type argument to `New`. For example:
```go
intChanQueue := channelqueue.New[int](1024)
stringChanQueue := channelqueue.New[string](-1)
intChanQueue := channelqueue.New[int]()
stringChanQueue := channelqueue.New[string]()
```

ChannelQueue can be used to provide buffering between existing channels. Using an existing read chan, write chan, or both are supported:
```go
in := make(chan int)
out := make(chan int)

// Create a buffer between in and out channels.
channelqueue.New(channelqueue.WithInput[int](in), channelqueue.WithOutput[int](out))
// ...
close(in) // this will close cq when all output is read.
```

0 comments on commit 10df303

Please sign in to comment.