#[non_exhaustive]pub struct ProcedureContext<'a> {
pub host: Option<&'a dyn ProcedureHost>,
pub deadline: Option<Duration>,
pub principal: Option<&'a Principal>,
pub _marker: PhantomData<&'a ()>,
}Expand description
Per-call context passed to ProcedurePlugin::invoke.
Carries an optional host pointer (for in-tree built-ins that need
snapshot / schema / algorithm access), an optional principal (for
capability gating), and an optional wall-clock deadline. All fields
are Option so pure procedures and unit tests can construct a
context with ProcedureContext::default.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.host: Option<&'a dyn ProcedureHost>Host services pointer; None in pure procedure tests.
deadline: Option<Duration>Optional wall-clock deadline for the procedure invocation.
principal: Option<&'a Principal>Authenticated principal, if any.
_marker: PhantomData<&'a ()>Lifetime marker. The plugin ABI keeps 'a exposed so future
fields (session / transaction) can borrow without a breaking
change.
Implementations§
Source§impl<'a> ProcedureContext<'a>
impl<'a> ProcedureContext<'a>
Sourcepub fn with_host(self, host: &'a dyn ProcedureHost) -> Self
pub fn with_host(self, host: &'a dyn ProcedureHost) -> Self
Attach a host pointer.
Sourcepub fn with_deadline(self, deadline: Duration) -> Self
pub fn with_deadline(self, deadline: Duration) -> Self
Attach a wall-clock deadline.
Sourcepub fn with_principal(self, principal: &'a Principal) -> Self
pub fn with_principal(self, principal: &'a Principal) -> Self
Attach an authenticated principal.
Trait Implementations§
Source§impl Debug for ProcedureContext<'_>
impl Debug for ProcedureContext<'_>
Source§impl<'a> Default for ProcedureContext<'a>
impl<'a> Default for ProcedureContext<'a>
Source§fn default() -> ProcedureContext<'a>
fn default() -> ProcedureContext<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ProcedureContext<'a>
impl<'a> !UnwindSafe for ProcedureContext<'a>
impl<'a> Freeze for ProcedureContext<'a>
impl<'a> Send for ProcedureContext<'a>
impl<'a> Sync for ProcedureContext<'a>
impl<'a> Unpin for ProcedureContext<'a>
impl<'a> UnsafeUnpin for ProcedureContext<'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
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more