pub struct StreamId {
pub value: u64,
}Expand description
Unique identifier representing the stream on which work is submitted.
How the current stream is resolved depends on the active
StreamPolicy and on any explicit override installed
with StreamId::executes or Stream::enter.
Fields§
§value: u64The value representing the stream id.
Implementations§
Source§impl StreamId
impl StreamId
Sourcepub fn executes<F, T>(self, f: F) -> Twhere
F: FnOnce() -> T,
pub fn executes<F, T>(self, f: F) -> Twhere
F: FnOnce() -> T,
Executes f on this stream, restoring the previous stream afterward.
The previous state is saved before the call and restored on return — including on unwind — so the caller never has to manage raw override pairs. Restoring also works when no stream was active before the call.
Sourcepub fn current() -> StreamId
pub fn current() -> StreamId
Get the current stream id.
Resolution order:
- An explicit override installed by
StreamId::executes. - The active
StreamPolicy: a stable per-task id underPerTask, stream0underSingle, or a lazily assigned per-thread id otherwise.
Trait Implementations§
impl Copy for StreamId
Source§impl<'de> Deserialize<'de> for StreamId
impl<'de> Deserialize<'de> for StreamId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for StreamId
Source§impl Ord for StreamId
impl Ord for StreamId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for StreamId
impl PartialOrd for StreamId
Source§impl Serialize for StreamId
impl Serialize for StreamId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for StreamId
Auto Trait Implementations§
impl Freeze for StreamId
impl RefUnwindSafe for StreamId
impl Send for StreamId
impl Sync for StreamId
impl Unpin for StreamId
impl UnsafeUnpin for StreamId
impl UnwindSafe for StreamId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.