pub struct Context {
pub deadline: Option<Deadline>,
pub principal: Option<Principal>,
pub trace_id: Option<TraceId>,
pub cache_policy: CachePolicy,
pub cancellation: Cancellation,
}Expand description
Execution context propagated through every query resolution and command dispatch. Carries deadline, auth principal, trace id, cache policy, and cancellation signal.
Fields§
§deadline: Option<Deadline>Absolute deadline for the resolution.
principal: Option<Principal>Auth principal.
trace_id: Option<TraceId>Trace id.
cache_policy: CachePolicyCache policy.
cancellation: CancellationCancellation signal.
Implementations§
Source§impl Context
impl Context
Sourcepub fn with_deadline(self, d: Deadline) -> Self
pub fn with_deadline(self, d: Deadline) -> Self
Set the deadline.
Sourcepub fn with_principal(self, p: Principal) -> Self
pub fn with_principal(self, p: Principal) -> Self
Set the principal.
Sourcepub fn with_trace(self, t: TraceId) -> Self
pub fn with_trace(self, t: TraceId) -> Self
Set the trace id.
Sourcepub fn with_cache_policy(self, p: CachePolicy) -> Self
pub fn with_cache_policy(self, p: CachePolicy) -> Self
Set the cache policy.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Context
impl<'de> Deserialize<'de> for Context
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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