Struct Opaque
pub struct Opaque { /* private fields */ }Expand description
An opaque payload.
Opaque payloads provide an escape hatch to carry arbitrarily shaped, telemetry-adjacent data across a topology. They
follow the common “Any” pattern from Protocol Buffers, where an encoded value is carried as raw bytes alongside
the qualified name of the data type, which allows callers to do lightweight filtering of events by type name before
attempting to fallibly decode the raw bytes into the concrete type identified by the type name field.
Implementations§
§impl Opaque
impl Opaque
pub fn new(type_name: impl Into<MetaString>, data: Bytes) -> Opaque
pub fn new(type_name: impl Into<MetaString>, data: Bytes) -> Opaque
Creates a new Opaque from the given type name and encoded data.
pub fn encode<T>(value: &T) -> Opaquewhere
T: OpaqueType,
pub fn encode<T>(value: &T) -> Opaquewhere
T: OpaqueType,
Creates a new Opaque by encoding the given value.
pub fn is<T>(&self) -> boolwhere
T: OpaqueType,
pub fn is<T>(&self) -> boolwhere
T: OpaqueType,
Returns true if the type name is the type name of T.
pub fn try_decode<T>(&self) -> Result<Option<T>, Error>where
T: OpaqueType,
pub fn try_decode<T>(&self) -> Result<Option<T>, Error>where
T: OpaqueType,
Decodes the data as a value of type T, if the type name is the type name of T.
If the type name isn’t the type name of T, Ok(None) is returned.
§Errors
If the type name matches, but the data isn’t a valid encoding of T, an error is returned.
Trait Implementations§
Source§impl EventKind for Opaque
impl EventKind for Opaque
Source§const EVENT_TYPE: EventType = EventType::Opaque
const EVENT_TYPE: EventType = EventType::Opaque
Source§fn into_event(self) -> Event
fn into_event(self) -> Event
Event.Source§fn try_from_event(event: Event) -> Result<Self, Event>
fn try_from_event(event: Event) -> Result<Self, Event>
Source§fn try_from_event_ref(event: &Event) -> Option<&Self>
fn try_from_event_ref(event: &Event) -> Option<&Self>
Source§fn try_from_event_mut(event: &mut Event) -> Option<&mut Self>
fn try_from_event_mut(event: &mut Event) -> Option<&mut Self>
impl StructuralPartialEq for Opaque
Auto Trait Implementations§
impl !Freeze for Opaque
impl RefUnwindSafe for Opaque
impl Send for Opaque
impl Sync for Opaque
impl Unpin for Opaque
impl UnsafeUnpin for Opaque
impl UnwindSafe for Opaque
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more