pub struct CallContextWithCx<'a> { /* private fields */ }Expand description
Call context with an attached capability context.
This wrapper is intended for framework integrations that need to thread
Cx through gRPC handlers while retaining the base call metadata.
ⓘ
use asupersync::cx::cap::CapSet;
use asupersync::grpc::CallContext;
type GrpcCaps = CapSet<true, true, false, false, false>;
fn handle(ctx: &CallContext, cx: &asupersync::Cx) {
let ctx = ctx.with_cx(cx);
let limited = ctx.cx_narrow::<GrpcCaps>();
limited.checkpoint().ok();
}Implementations§
Source§impl CallContextWithCx<'_>
impl CallContextWithCx<'_>
Sourcepub fn call(&self) -> &CallContext
pub fn call(&self) -> &CallContext
Returns the underlying call context.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if the call deadline has expired.
Sourcepub fn cx_narrow<Caps>(&self) -> Cx<Caps>
pub fn cx_narrow<Caps>(&self) -> Cx<Caps>
Returns a narrowed capability context (least privilege).
Sourcepub fn cx_readonly(&self) -> Cx<None>
pub fn cx_readonly(&self) -> Cx<None>
Returns a fully restricted context (no capabilities).
Auto Trait Implementations§
impl<'a> Freeze for CallContextWithCx<'a>
impl<'a> !RefUnwindSafe for CallContextWithCx<'a>
impl<'a> Send for CallContextWithCx<'a>
impl<'a> Sync for CallContextWithCx<'a>
impl<'a> Unpin for CallContextWithCx<'a>
impl<'a> UnsafeUnpin for CallContextWithCx<'a>
impl<'a> !UnwindSafe for CallContextWithCx<'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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).