MCPcopy Index your code
hub / github.com/aws/aws-lambda-rust-runtime / channel

Function channel

lambda-runtime-api-client/src/body/watch.rs:23–32  ·  view source on GitHub ↗
(initial: Value)

Source from the content-addressed store, hash-verified

21pub(crate) const CLOSED: usize = 0;
22
23pub(crate) fn channel(initial: Value) -> (Sender, Receiver) {
24 debug_assert!(initial != CLOSED, "watch::channel initial state of 0 is reserved");
25
26 let shared = Arc::new(Shared {
27 value: AtomicUsize::new(initial),
28 waker: AtomicWaker::new(),
29 });
30
31 (Sender { shared: shared.clone() }, Receiver { shared })
32}
33
34pub(crate) struct Sender {
35 shared: Arc<Shared>,

Callers 1

channelMethod · 0.70

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected