pub struct ModeRef<'a> { /* private fields */ }Expand description
A handle that allows calling mode methods without keeping the registry read lock held across callback execution.
Implementations§
Source§impl<'a> ModeRef<'a>
impl<'a> ModeRef<'a>
pub fn on_session_start( &self, session: &Session, env: &Envelope, ) -> Result<ModeResponse, MacpError>
pub fn on_message( &self, session: &Session, env: &Envelope, ) -> Result<ModeResponse, MacpError>
Sourcepub fn on_message_at(
&self,
session: &Session,
env: &Envelope,
ctx: &MessageContext,
) -> Result<ModeResponse, MacpError>
pub fn on_message_at( &self, session: &Session, env: &Envelope, ctx: &MessageContext, ) -> Result<ModeResponse, MacpError>
Kernel entry point: on_message with the runtime’s acceptance-clock
context. The runtime and replay call this so modes that need a
trustworthy time source receive the log-recorded clock.
Sourcepub fn validate_client_envelope(
&self,
session: &Session,
env: &Envelope,
) -> Result<(), MacpError>
pub fn validate_client_envelope( &self, session: &Session, env: &Envelope, ) -> Result<(), MacpError>
The client boundary. Forwards to crate::mode::Mode::validate_client_envelope.
Live client path only — the kernel must not call this on replay, nor on an envelope it synthesized itself. See the trait method for why the distinction cannot be made inside the mode’s own dispatch.
Sourcepub fn due_synthetic_envelope(
&self,
session: &Session,
now_ms: i64,
) -> Option<Envelope>
pub fn due_synthetic_envelope( &self, session: &Session, now_ms: i64, ) -> Option<Envelope>
The synthesis seam. Forwards to
crate::mode::Mode::due_synthetic_envelope; see that method for the
contract a caller owes the returned envelope.
A mode that has vanished from the registry between lookup and call
yields None rather than an error: “nothing is due” is the correct
answer for a mode that no longer exists, and the kernel’s caller
already treats an unknown mode as nothing-to-synthesize.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ModeRef<'a>
impl<'a> !UnwindSafe for ModeRef<'a>
impl<'a> Freeze for ModeRef<'a>
impl<'a> Send for ModeRef<'a>
impl<'a> Sync for ModeRef<'a>
impl<'a> Unpin for ModeRef<'a>
impl<'a> UnsafeUnpin for ModeRef<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request