Struct apollo_router::ExtensionsMutex
source ยท pub struct ExtensionsMutex { /* private fields */ }Expand description
You can use Extensions to pass data between plugins that is not serializable. Such data is not accessible from Rhai or co-processoers.
This can be accessed at any point in the request lifecycle and is useful for passing data between services. Extensions are thread safe, and must be locked for mutation.
For example:
context.extensions().lock().insert::<MyData>(data);
Implementationsยง
sourceยงimpl ExtensionsMutex
impl ExtensionsMutex
sourcepub fn lock(&self) -> ExtensionsGuard<'_>
pub fn lock(&self) -> ExtensionsGuard<'_>
Locks the extensions for mutation.
It is CRITICAL to avoid holding on to the mutex guard for too long, particularly across async calls. Doing so may cause performance degradation or even deadlocks.
See related clippy lint for examples: https://rust-lang.github.io/rust-clippy/master/index.html#/await_holding_lock
Trait Implementationsยง
sourceยงimpl Clone for ExtensionsMutex
impl Clone for ExtensionsMutex
sourceยงfn clone(&self) -> ExtensionsMutex
fn clone(&self) -> ExtensionsMutex
Returns a copy of the value. Read more
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceยงimpl Debug for ExtensionsMutex
impl Debug for ExtensionsMutex
sourceยงimpl Default for ExtensionsMutex
impl Default for ExtensionsMutex
sourceยงfn default() -> ExtensionsMutex
fn default() -> ExtensionsMutex
Returns the โdefault valueโ for a type. Read more
Auto Trait Implementationsยง
impl !RefUnwindSafe for ExtensionsMutex
impl Send for ExtensionsMutex
impl Sync for ExtensionsMutex
impl Unpin for ExtensionsMutex
impl !UnwindSafe for ExtensionsMutex
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> FutureExt for T
impl<T> FutureExt for T
sourceยงfn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourceยงfn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.
sourceยงimpl<T> Variant for T
impl<T> Variant for T
sourceยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant trait object to &mut dyn Any.sourceยงfn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant trait object to Box<dyn Any>.