#[non_exhaustive]pub struct DynInstrumentation { /* private fields */ }
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Expand description
An optional dyn instrumentation.
For ease of use, this type implements Deref
and DerefMut
to &dyn Instrumentation
,
falling back to a no-op implementation if no instrumentation is set.
The DynInstrumentation type is useful because without it we actually did tend to return
(accidentally) &mut Option
Implementations§
Source§impl DynInstrumentation
impl DynInstrumentation
pub fn default_instrumentation() -> Self
pub fn none() -> Self
pub fn on_connection_event(&mut self, event: InstrumentationEvent<'_>)
Methods from Deref<Target = dyn Instrumentation>§
Sourcepub fn is<__T: Instrumentation>(&self) -> bool
pub fn is<__T: Instrumentation>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
Sourcepub fn downcast_rc<__T: Instrumentation>(
self: Rc<Self>,
) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: Instrumentation>( self: Rc<Self>, ) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
Sourcepub fn downcast_ref<__T: Instrumentation>(&self) -> Option<&__T>
pub fn downcast_ref<__T: Instrumentation>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
Sourcepub fn downcast_mut<__T: Instrumentation>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: Instrumentation>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.
Trait Implementations§
Source§impl Deref for DynInstrumentation
impl Deref for DynInstrumentation
Source§impl DerefMut for DynInstrumentation
impl DerefMut for DynInstrumentation
Source§impl<I: Instrumentation> From<I> for DynInstrumentation
impl<I: Instrumentation> From<I> for DynInstrumentation
Auto Trait Implementations§
impl Freeze for DynInstrumentation
impl !RefUnwindSafe for DynInstrumentation
impl Send for DynInstrumentation
impl !Sync for DynInstrumentation
impl Unpin for DynInstrumentation
impl !UnwindSafe for DynInstrumentation
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.