array

Function array 

Source
pub fn array<T, const N: usize>() -> [Sender<T, [Element<T>; N]>; N]
Expand description

Construct an array of senders to a slot, whose values will be placed on an array.

This function is specialized to returning an array of senders instead of an iterator in order to keep resulting length constant.

ยงExamples

let [s1, s2, s3] = either_slot::array();
s1.send(1).unwrap();
s2.send(2).unwrap();
let iter = s3.send(3).unwrap_err();
assert_eq!(iter.collect::<Vec<_>>(), [1, 2, 3]);
let [s1, s2, s3] = either_slot::array();
drop(s1);
s3.send(3).unwrap();
let iter = s2.send(2).unwrap_err();
assert_eq!(iter.collect::<Vec<_>>(), [2, 3]);