pub struct Channel {
pub id: ChannelId,
pub name: String,
pub direction: Direction,
pub subscribers: BTreeSet<u64>,
pub sent: u64,
pub received: u64,
/* private fields */
}Expand description
A named channel.
Fields§
§id: ChannelId§name: String§direction: Direction§subscribers: BTreeSet<u64>§sent: u64Total messages sent (including those already received).
received: u64Total messages received.
Implementations§
Source§impl Channel
impl Channel
pub fn new(id: ChannelId, name: impl Into<String>, direction: Direction) -> Self
Sourcepub fn can_receive(&self) -> bool
pub fn can_receive(&self) -> bool
Whether the channel has messages for a receiver.
Sourcepub fn send(
&mut self,
from: LaneId,
payload: Value,
caps: Vec<CapId>,
) -> Result<Message>
pub fn send( &mut self, from: LaneId, payload: Value, caps: Vec<CapId>, ) -> Result<Message>
Queue a message.
pub fn is_empty(&self) -> bool
pub fn is_closed(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more