pub struct SearchAttributeKey<T>where
T: SearchAttributeValue,{ /* private fields */ }Expand description
A typed handle for a named search attribute, carrying its value type at the
type level. Construct via the const factory methods such as
SearchAttributeKey::bool, SearchAttributeKey::keyword, etc.
§Key names
Key names must be &'static str, which enables compile-time construction
via const but means runtime-determined key names are not supported.
For dynamic key names (e.g., from config), use
SearchAttributes::raw_payload as an escape hatch for untyped access.
use temporalio_common_wasm::search_attributes::SearchAttributeKey;
const MY_KEY: SearchAttributeKey<String> = SearchAttributeKey::keyword("my_attr");Implementations§
Source§impl<T> SearchAttributeKey<T>where
T: SearchAttributeValue,
impl<T> SearchAttributeKey<T>where
T: SearchAttributeValue,
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns the attribute name used as the key in the proto map.
Sourcepub fn indexed_value_type(&self) -> IndexedValueType
pub fn indexed_value_type(&self) -> IndexedValueType
Returns the IndexedValueType configured for this key.
Sourcepub fn value_set(&self, val: T) -> SearchAttributeUpdate
pub fn value_set(&self, val: T) -> SearchAttributeUpdate
Create a SearchAttributeUpdate that sets the attribute to the given value.
§Panics
Panics if the value cannot be serialized to JSON. This can happen for
f64 values that are NaN or Infinity (which are not valid JSON),
or for Timestamp values with out-of-range seconds. Use
try_value_set for a fallible alternative.
Sourcepub fn try_value_set(
&self,
val: T,
) -> Result<SearchAttributeUpdate, SearchAttributeError>
pub fn try_value_set( &self, val: T, ) -> Result<SearchAttributeUpdate, SearchAttributeError>
Fallible version of value_set. Returns an error
instead of panicking if the value cannot be serialized.
Sourcepub fn value_unset(&self) -> SearchAttributeUpdate
pub fn value_unset(&self) -> SearchAttributeUpdate
Create a SearchAttributeUpdate that removes this attribute.
Source§impl SearchAttributeKey<bool>
impl SearchAttributeKey<bool>
Sourcepub const fn bool(name: &'static str) -> SearchAttributeKey<bool>
pub const fn bool(name: &'static str) -> SearchAttributeKey<bool>
Create a key for a Bool-typed search attribute.
Source§impl SearchAttributeKey<i64>
impl SearchAttributeKey<i64>
Sourcepub const fn int(name: &'static str) -> SearchAttributeKey<i64>
pub const fn int(name: &'static str) -> SearchAttributeKey<i64>
Create a key for an Int-typed search attribute.
Source§impl SearchAttributeKey<f64>
impl SearchAttributeKey<f64>
Sourcepub const fn float(name: &'static str) -> SearchAttributeKey<f64>
pub const fn float(name: &'static str) -> SearchAttributeKey<f64>
Create a key for a Double-typed search attribute.
Source§impl SearchAttributeKey<String>
impl SearchAttributeKey<String>
Sourcepub const fn keyword(name: &'static str) -> SearchAttributeKey<String>
pub const fn keyword(name: &'static str) -> SearchAttributeKey<String>
Create a key for a Keyword-typed search attribute.
Sourcepub const fn text(name: &'static str) -> SearchAttributeKey<String>
pub const fn text(name: &'static str) -> SearchAttributeKey<String>
Create a key for a Text-typed search attribute.
Source§impl SearchAttributeKey<Timestamp>
impl SearchAttributeKey<Timestamp>
Sourcepub const fn datetime(name: &'static str) -> SearchAttributeKey<Timestamp>
pub const fn datetime(name: &'static str) -> SearchAttributeKey<Timestamp>
Create a key for a Datetime-typed search attribute.
Source§impl SearchAttributeKey<Vec<String>>
impl SearchAttributeKey<Vec<String>>
Sourcepub const fn keyword_list(name: &'static str) -> SearchAttributeKey<Vec<String>>
pub const fn keyword_list(name: &'static str) -> SearchAttributeKey<Vec<String>>
Create a key for a KeywordList-typed search attribute.
Trait Implementations§
Source§impl<T> Clone for SearchAttributeKey<T>where
T: Clone + SearchAttributeValue,
impl<T> Clone for SearchAttributeKey<T>where
T: Clone + SearchAttributeValue,
Source§fn clone(&self) -> SearchAttributeKey<T>
fn clone(&self) -> SearchAttributeKey<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<T> Copy for SearchAttributeKey<T>where
T: Copy + SearchAttributeValue,
Auto Trait Implementations§
impl<T> Freeze for SearchAttributeKey<T>
impl<T> RefUnwindSafe for SearchAttributeKey<T>where
T: RefUnwindSafe,
impl<T> Send for SearchAttributeKey<T>where
T: Send,
impl<T> Sync for SearchAttributeKey<T>where
T: Sync,
impl<T> Unpin for SearchAttributeKey<T>where
T: Unpin,
impl<T> UnsafeUnpin for SearchAttributeKey<T>
impl<T> UnwindSafe for SearchAttributeKey<T>where
T: UnwindSafe,
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