Golang-design/chann: A Unified Channel Package For ... - GitHub

Skip to content Dismiss alert {{ message }} / chann Public
  • Notifications You must be signed in to change notification settings
  • Fork 6
  • Star 43
  • Code
  • Issues 1
  • Pull requests 1
  • Actions
  • Projects
  • Security
  • Insights
Additional navigation options  mainBranchesTagsGo to fileCode

Folders and files

NameNameLast commit messageLast commit date

Latest commit

 

History

14 Commits
.github/workflows.github/workflows  
.gitignore.gitignore  
LICENSELICENSE  
README.mdREADME.md  
chann.gochann.go  
chann_test.gochann_test.go  
example_test.goexample_test.go  
export_test.goexport_test.go  
go.modgo.mod  
lb.golb.go  
lb_test.golb_test.go  
utils.goutils.go  
utils_test.goutils_test.go  
View all files

Repository files navigation

  • README
  • MIT license
chann example workflow

a unified channel package in Go

import "golang.design/x/chann"

This package requires Go 1.18.

Basic Usage

Different types of channels:

ch := chann.New[int]() // unbounded, capacity unlimited ch := chann.New[func()](chann.Cap(0)) // unbufferd, capacity 0 ch := chann.New[string](chann.Cap(100)) // buffered, capacity 100

Send and receive operations:

ch.In() <- 42 println(<-ch.Out()) // 42

Close operation:

ch.Close()

Channel properties:

ch.Len() // the length of the channel ch.Cap() // the capacity of the channel

See https://golang.design/research/ultimate-channel for more details of the motivation of this abstraction.

License

MIT | © 2021 The golang.design Initiative Authors, written by Changkun Ou.

About

a unified channel package for buffered, unbuffered, and unbounded channels

golang.design/x/chann

Topics

golang channels generics unbounded-channel

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.

Activity Custom properties

Stars

43 stars

Watchers

2 watching

Forks

6 forks Report repository

Releases

3 tags

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

  • Go 100.0%
You can’t perform that action at this time.

Từ khóa » Ch Ann