Skip to main content

FnMutMessageHandler

Struct FnMutMessageHandler 

Source
pub struct FnMutMessageHandler { /* private fields */ }

Implementations§

Source§

impl FnMutMessageHandler

Source

pub const fn new() -> Self

Source

pub fn set<T>( &mut self, ctx: &mut T, func: fn(&mut T, &[u8], &AeronHeader), ) -> &mut Self

Point this handler at ctx / func so the next call dispatches into them.

§Lifetime contract (caller must uphold)

ctx is stored as a raw *mut () that escapes the borrow, so the borrow checker does NOT keep it alive. The caller MUST ensure ctx outlives every subsequent call (i.e. ctx is dropped only after this handler is retired or re-set). Calling call after ctx is dropped is use-after-free. ctx must also not be moved while borrowed.

Source

pub fn call(&mut self, msg: &[u8], header: &AeronHeader)

Source

pub const fn clear(&mut self)

Drop the borrowed ctx so a later stray call is a safe no-op (the noop func is restored and the pointer nulled) rather than a use-after-free.

AeronFragmentClosureAssembler::poll calls this before returning so the raw pointer never outlives the borrow it was created from.

Trait Implementations§

Auto Trait Implementations§

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.