ProbeArgWrapper

Trait ProbeArgWrapper 

Source
pub trait ProbeArgWrapper: Debug {
    type CType: ProbeArgNativeTypeInfo + ProbeArgNativeType<Self::CType>;

    // Required method
    fn as_c_type(&self) -> Self::CType;

    // Provided method
    fn default_c_value() -> Self::CType { ... }
}
Expand description

This trait, a companion to ProbeArgType, wraps a supported type and on demand converts it to its equivalent C type. For scalar types that are directly supported there is no overhead to this wrapping, but many more complicated types, including Rust string types, need additional logic to produce a NULL-terminated byte array.

Required Associated Types§

Required Methods§

Source

fn as_c_type(&self) -> Self::CType

Convert the probe argument from it’s Rust type to one compatible with the native tracing library infrastructure.

Provided Methods§

Source

fn default_c_value() -> Self::CType

This is ugly but unavoidable. The underlying C type for an Opt is the same C type as T. We will use the default value for T to indicate a value of None. That will have to be good enough.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ProbeArgWrapper for bool

Source§

impl ProbeArgWrapper for i8

Source§

impl ProbeArgWrapper for i16

Source§

impl ProbeArgWrapper for i32

Source§

impl ProbeArgWrapper for i64

Source§

impl ProbeArgWrapper for isize

Source§

impl ProbeArgWrapper for u8

Source§

impl ProbeArgWrapper for u16

Source§

impl ProbeArgWrapper for u32

Source§

impl ProbeArgWrapper for u64

Source§

impl ProbeArgWrapper for usize

Source§

impl<'a> ProbeArgWrapper for &'a CString

Source§

impl<'a> ProbeArgWrapper for &'a CStr

Source§

impl<'a> ProbeArgWrapper for Option<CString>

Source§

impl<T> ProbeArgWrapper for Option<T>

Source§

impl<T> ProbeArgWrapper for *const T

Implementors§