Skip to main content

SeqMut

Struct SeqMut 

Source
pub struct SeqMut<'w>(/* private fields */);
Expand description

Mutable access to the world’s current sequence number.

Allows handlers to advance the sequence — useful for stamping outbound messages with monotonic sequence numbers.

§Example

use nexus_rt::{SeqMut, Handler, IntoHandler};

fn send_message(mut seq: SeqMut<'_>, event: u64) {
    let msg_seq = seq.advance();
    // stamp msg_seq on outbound message
}

Implementations§

Source§

impl SeqMut<'_>

Source

pub fn get(&self) -> Sequence

Returns the current sequence value.

Source

pub fn advance(&mut self) -> Sequence

Advance the sequence by 1 and return the new value.

Trait Implementations§

Source§

impl Param for SeqMut<'_>

Source§

type State = ()

Opaque state cached at build time (e.g. ResourceId). Read more
Source§

type Item<'w> = SeqMut<'w>

The item produced at dispatch time.
Source§

fn init(_registry: &Registry)

Resolve state from the registry. Called once at build time. Read more
Source§

unsafe fn fetch<'w>(world: &'w World, _state: &'w mut ()) -> SeqMut<'w>

Fetch the item using cached state. Read more
Source§

fn resource_id(state: &Self::State) -> Option<ResourceId>

The ResourceId this param accesses, if any. Read more

Auto Trait Implementations§

§

impl<'w> Freeze for SeqMut<'w>

§

impl<'w> !RefUnwindSafe for SeqMut<'w>

§

impl<'w> !Send for SeqMut<'w>

§

impl<'w> !Sync for SeqMut<'w>

§

impl<'w> Unpin for SeqMut<'w>

§

impl<'w> UnsafeUnpin for SeqMut<'w>

§

impl<'w> !UnwindSafe for SeqMut<'w>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.