pub struct SharedIds { /* private fields */ }Expand description
One allocator, shared by every shard of a runtime.
The lock is taken per allocation rather than for a whole render, so two
shards rendering on two cores contend for a few nanoseconds at a time instead
of serializing. It is never held across an .await: every method here
returns before the caller can suspend.
Implementations§
pub fn new() -> SharedIds
Sourcepub fn session(&self, occupant: Occupant) -> Result<SessionId, Exhausted>
pub fn session(&self, occupant: Occupant) -> Result<SessionId, Exhausted>
The session for occupant, stable for as long as the runtime lives.
§Errors
Exhausted::Sessions once every session has been handed out.
Sourcepub fn allocated_session(&self, occupant: Occupant) -> Option<SessionId>
pub fn allocated_session(&self, occupant: Occupant) -> Option<SessionId>
The session already allocated for occupant, without allocating.
Sourcepub fn allocated_channel(
&self,
shard: ShardId,
key: ChannelKey,
) -> Option<ChannelId>
pub fn allocated_channel( &self, shard: ShardId, key: ChannelKey, ) -> Option<ChannelId>
The id already allocated for key within shard, without allocating.
Sourcepub fn retain_channels(&self, shard: ShardId, retained: &BTreeSet<ChannelKey>)
pub fn retain_channels(&self, shard: ShardId, retained: &BTreeSet<ChannelKey>)
Retire the channel identities absent from one shard’s accepted render.
Sourcepub fn retire_channel_ids(&self, shard: ShardId, retired: &BTreeSet<ChannelId>)
pub fn retire_channel_ids(&self, shard: ShardId, retired: &BTreeSet<ChannelId>)
Retire channel ids one client has accepted as removed.
Trait Implementations§
Auto Trait Implementations§
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