Skip to main content

SearchAttributes

Struct SearchAttributes 

Source
pub struct SearchAttributes { /* private fields */ }
Expand description

A collection of search attribute payloads, providing type-safe access via SearchAttributeKey.

Implementations§

Source§

impl SearchAttributes

Source

pub fn new( updates: impl IntoIterator<Item = SearchAttributeUpdate>, ) -> SearchAttributes

Construct from an iterator of SearchAttributeUpdates.

Updates with None payloads remove any existing entry for that key.

Source

pub fn apply(&mut self, update: SearchAttributeUpdate)

Apply a single update to this collection. If the update sets a value, it is inserted (replacing any existing entry); if the update unsets a value, the entry is removed.

Source

pub fn get<T>(&self, key: &SearchAttributeKey<T>) -> Option<T>

Retrieve a typed value. Returns None if the key is absent or deserialization fails (graceful degradation — no panic on type mismatch).

Source

pub fn try_get<T>( &self, key: &SearchAttributeKey<T>, ) -> Result<Option<T>, SearchAttributeError>

Retrieve a typed value, distinguishing “key absent” from “deserialization failed”. Returns Ok(None) if the key is absent, Ok(Some(val)) on success, or Err if the payload is present but cannot be deserialized.

Source

pub fn contains_key<T>(&self, key: &SearchAttributeKey<T>) -> bool

Returns true if a payload exists for the given key.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no search attributes.

Source

pub fn len(&self) -> usize

Returns the number of search attributes.

Source

pub fn keys(&self) -> impl Iterator<Item = &str>

Returns an iterator over the attribute names in this collection.

Source

pub fn raw_payload(&self, name: &str) -> Option<&Payload>

Returns a reference to the raw payload for the given attribute name, if present. This is useful for advanced use cases such as forwarding payloads without deserializing them.

Source

pub fn to_proto(&self) -> SearchAttributes

Convert to the proto wire representation.

Source

pub fn into_proto(self) -> SearchAttributes

Convert to the proto wire representation, consuming self to avoid cloning.

Source

pub fn from_proto(attrs: &SearchAttributes) -> SearchAttributes

Construct from the proto wire representation by cloning the inner map.

Source§

impl SearchAttributes

Source

pub fn updates_to_proto( updates: impl IntoIterator<Item = SearchAttributeUpdate>, ) -> SearchAttributes

Convert to the proto representation, producing empty-data payloads for entries that were unset. This is used when building an upsert command that needs to explicitly clear attributes on the server.

Trait Implementations§

Source§

impl Clone for SearchAttributes

Source§

fn clone(&self) -> SearchAttributes

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SearchAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for SearchAttributes

Source§

fn default() -> SearchAttributes

Returns the “default value” for a type. Read more
Source§

impl From<SearchAttributes> for SearchAttributes

Source§

fn from(attrs: SearchAttributes) -> SearchAttributes

Construct from an owned proto, moving the inner map without cloning.

Source§

impl PartialEq for SearchAttributes

Source§

fn eq(&self, other: &SearchAttributes) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SearchAttributes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more