pub struct Tag(_);
Expand description
A i64
value used as a message tag.
Processes can selectively receive messages based on the message’s tag. This mechanism can be used to handle messages in a different order from their arrival.
Creating a new tag will return a process-unique value. Some tag values are reserved for internal use only, but the range from 64 to 128 can be used by the developer to assign application specific meaning.
Implementations
sourceimpl Tag
impl Tag
sourcepub fn new() -> Tag
pub fn new() -> Tag
Returns a unique tag inside this process.
Two calls to Tag::new()
are guaranteed to return a unique tag only if
they occurred inside the same process.
sourcepub fn none() -> Tag
pub fn none() -> Tag
Returns a special tag that is used by Process::send
.
Most messages where the order is not significant use this tag.
sourcepub fn special(id: i64) -> Option<Tag>
pub fn special(id: i64) -> Option<Tag>
Create a special purpose tag.
The id
must be in the range between 64 and 128 or the function will
return None
.
pub fn id(&self) -> i64
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Tag
impl<'de> Deserialize<'de> for Tag
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<Tag> for Tag
impl PartialEq<Tag> for Tag
impl Copy for Tag
impl Eq for Tag
impl StructuralEq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more