#[non_exhaustive]pub struct TriggerContext<'a> {
pub session_id: &'a str,
pub tx_id: u64,
/* private fields */
}Expand description
Per-fire context.
§ABI note (3.0 breaking change)
Carries an owned optional ProcedureHost handle so a declared
(synthesized) trigger can reach the host’s write-enabled inner-query
primitive from inside fire. The handle is owned (not borrowed)
because the after-commit async dispatch path moves the context into a
'static spawned task and rebuilds it there — a borrow could not
outlive the commit stack frame. Native trigger plugins that never
touch host() are unaffected (the field defaults to None).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session_id: &'a strSession identifier.
tx_id: u64Transaction identifier.
Implementations§
Source§impl<'a> TriggerContext<'a>
impl<'a> TriggerContext<'a>
Sourcepub fn new(session_id: &'a str, tx_id: u64) -> Self
pub fn new(session_id: &'a str, tx_id: u64) -> Self
Construct a fresh context with no host handle. The struct is
#[non_exhaustive] so external callers can’t use struct-literal
syntax; this constructor is the supported path. Future fields
ship via with_* builder methods to preserve API compatibility.
Sourcepub fn with_host(self, host: Arc<dyn ProcedureHost>) -> Self
pub fn with_host(self, host: Arc<dyn ProcedureHost>) -> Self
Attach an owned host handle to this context.
The commit-path dispatcher threads a write-enabled host through so
a declared trigger’s fire can downcast it (via
ProcedureHost::as_any) and run its stored Cypher action body.
Sourcepub fn host(&self) -> Option<&Arc<dyn ProcedureHost>>
pub fn host(&self) -> Option<&Arc<dyn ProcedureHost>>
Borrow the attached host handle, when one was threaded in.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TriggerContext<'a>
impl<'a> !UnwindSafe for TriggerContext<'a>
impl<'a> Freeze for TriggerContext<'a>
impl<'a> Send for TriggerContext<'a>
impl<'a> Sync for TriggerContext<'a>
impl<'a> Unpin for TriggerContext<'a>
impl<'a> UnsafeUnpin for TriggerContext<'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
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>
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>
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