Skip to main content

AttributesLike

Trait AttributesLike 

Source
pub trait AttributesLike {
    type Value: AttributeLike;

    // Required methods
    fn as_object(&self) -> &Object<Self::Value>;
    fn as_object_mut(&mut self) -> &mut Object<Self::Value>;

    // Provided methods
    fn contains_key(&self, key: &str) -> bool { ... }
    fn insert(&mut self, key: String, value: Annotated<Self::Value>) { ... }
    fn remove(&mut self, key: &str) -> Option<Annotated<Self::Value>> { ... }
}
Expand description

An attribute collection which is keyed by an attribute key defined in relay_conventions.

This exists as a common abstraction over SpanData and Attributes. Its purpose is to allow modern attribute based normalizations also to apply to transaction based spans, eliminating the need to duplicate code.

This largely mirrors the API of Attributes and provides it also for SpanData.

Required Associated Types§

Source

type Value: AttributeLike

The attribute value.

Required Methods§

Source

fn as_object(&self) -> &Object<Self::Value>

Access this container through the underlying Object.

Source

fn as_object_mut(&mut self) -> &mut Object<Self::Value>

Access this container through the underlying Object mutably.

Provided Methods§

Source

fn contains_key(&self, key: &str) -> bool

Checks whether this collection contains an attribute with the given key.

Source

fn insert(&mut self, key: String, value: Annotated<Self::Value>)

Inserts an attribute with the given value into the collection.

Source

fn remove(&mut self, key: &str) -> Option<Annotated<Self::Value>>

Removes a key from the attribute collection returning its value.

Implementations on Foreign Types§

Source§

impl AttributesLike for Attributes

Source§

type Value = Attribute

Source§

fn as_object(&self) -> &Object<Self::Value>

Source§

fn as_object_mut(&mut self) -> &mut Object<Self::Value>

Source§

impl AttributesLike for SpanData

Source§

type Value = Value

Source§

fn as_object(&self) -> &Object<Self::Value>

Source§

fn as_object_mut(&mut self) -> &mut Object<Self::Value>

Implementors§