pub struct SearchAttributes { /* private fields */ }Expand description
A collection of search attribute payloads, providing type-safe access via
SearchAttributeKey.
Implementations§
Source§impl SearchAttributes
impl SearchAttributes
Sourcepub fn new(
updates: impl IntoIterator<Item = SearchAttributeUpdate>,
) -> SearchAttributes
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.
Sourcepub fn apply(&mut self, update: SearchAttributeUpdate)
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.
Sourcepub fn get<T>(&self, key: &SearchAttributeKey<T>) -> Option<T>where
T: SearchAttributeValue,
pub fn get<T>(&self, key: &SearchAttributeKey<T>) -> Option<T>where
T: SearchAttributeValue,
Retrieve a typed value. Returns None if the key is absent or
deserialization fails (graceful degradation — no panic on type mismatch).
Sourcepub fn try_get<T>(
&self,
key: &SearchAttributeKey<T>,
) -> Result<Option<T>, SearchAttributeError>where
T: SearchAttributeValue,
pub fn try_get<T>(
&self,
key: &SearchAttributeKey<T>,
) -> Result<Option<T>, SearchAttributeError>where
T: SearchAttributeValue,
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.
Sourcepub fn contains_key<T>(&self, key: &SearchAttributeKey<T>) -> boolwhere
T: SearchAttributeValue,
pub fn contains_key<T>(&self, key: &SearchAttributeKey<T>) -> boolwhere
T: SearchAttributeValue,
Returns true if a payload exists for the given key.
Sourcepub fn keys(&self) -> impl Iterator<Item = &str>
pub fn keys(&self) -> impl Iterator<Item = &str>
Returns an iterator over the attribute names in this collection.
Sourcepub fn raw_payload(&self, name: &str) -> Option<&Payload>
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.
Sourcepub fn to_proto(&self) -> SearchAttributes
pub fn to_proto(&self) -> SearchAttributes
Convert to the proto wire representation.
Sourcepub fn into_proto(self) -> SearchAttributes
pub fn into_proto(self) -> SearchAttributes
Convert to the proto wire representation, consuming self to avoid
cloning.
Sourcepub fn from_proto(attrs: &SearchAttributes) -> SearchAttributes
pub fn from_proto(attrs: &SearchAttributes) -> SearchAttributes
Construct from the proto wire representation by cloning the inner map.
Source§impl SearchAttributes
impl SearchAttributes
Sourcepub fn updates_to_proto(
updates: impl IntoIterator<Item = SearchAttributeUpdate>,
) -> SearchAttributes
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
impl Clone for SearchAttributes
Source§fn clone(&self) -> SearchAttributes
fn clone(&self) -> SearchAttributes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SearchAttributes
impl Debug for SearchAttributes
Source§impl Default for SearchAttributes
impl Default for SearchAttributes
Source§fn default() -> SearchAttributes
fn default() -> SearchAttributes
Source§impl From<SearchAttributes> for SearchAttributes
impl From<SearchAttributes> for SearchAttributes
Source§fn from(attrs: SearchAttributes) -> SearchAttributes
fn from(attrs: SearchAttributes) -> SearchAttributes
Construct from an owned proto, moving the inner map without cloning.
Source§impl PartialEq for SearchAttributes
impl PartialEq for SearchAttributes
impl StructuralPartialEq for SearchAttributes
Auto Trait Implementations§
impl Freeze for SearchAttributes
impl RefUnwindSafe for SearchAttributes
impl Send for SearchAttributes
impl Sync for SearchAttributes
impl Unpin for SearchAttributes
impl UnsafeUnpin for SearchAttributes
impl UnwindSafe for SearchAttributes
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::Request