pub enum EventAttribute {
V037(EventAttribute),
V034(EventAttribute),
}Expand description
The attributes of an Event consist of a key, a value, and an index flag. The index flag notifies the Tendermint indexer to index the attribute. The value of the index flag is non-deterministic and may vary across different nodes in the network.
Before Tendermint v0.37, the key and value can contain arbitrary byte arrays. Since Tendermint v0.37, the key and value are defined to be valid UTF-8 encoded strings.
IMPORTANT: The order of the two variants below is significant and must not be changed.
The EventAttribute enum is serialized and deserialized using the untagged attribute,
meaning that the first variant is tried first when deserializing, if that fails
then the second variant is tried. This allows us to deserialize v0.37+ events which
are vald UTF-8 strings, and fall back to deserializing v0.34 events which are arbitrary byte arrays.
Variants§
V037(EventAttribute)
EventAttribute keys and values in TM37 and later are plain strings.
V034(EventAttribute)
EventAttribute keys and values in TM34 are base64-encoded strings.
Implementations§
Source§impl EventAttribute
impl EventAttribute
Sourcepub fn key_str(&self) -> Result<&str, Error>
pub fn key_str(&self) -> Result<&str, Error>
Access the key field common to all variants of the enum as a string.
Will return error if the value is malformed UTF8.
Sourcepub fn key_bytes(&self) -> &[u8] ⓘ
pub fn key_bytes(&self) -> &[u8] ⓘ
Access the key field common to all variants of the enum as bytes.
Sourcepub fn value_str(&self) -> Result<&str, Error>
pub fn value_str(&self) -> Result<&str, Error>
Access the value field common to all variants of the enum as a string.
Will return error if the value is malformed UTF8.
Sourcepub fn value_bytes(&self) -> &[u8] ⓘ
pub fn value_bytes(&self) -> &[u8] ⓘ
Access the value field common to all variants of the enum as bytes.
This is useful if you have binary values for TM34.
Source§impl EventAttribute
impl EventAttribute
Sourcepub fn eq_ignoring_index(&self, other: &EventAttribute) -> bool
pub fn eq_ignoring_index(&self, other: &EventAttribute) -> bool
Checks whether &self is equal to other, ignoring the index field.
Sourcepub fn hash_ignoring_index<H>(&self, state: &mut H)where
H: Hasher,
pub fn hash_ignoring_index<H>(&self, state: &mut H)where
H: Hasher,
A variant of core::hash::Hash::hash that ignores the index field.
Trait Implementations§
Source§impl Clone for EventAttribute
impl Clone for EventAttribute
Source§fn clone(&self) -> EventAttribute
fn clone(&self) -> EventAttribute
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 EventAttribute
impl Debug for EventAttribute
Source§impl<'de> Deserialize<'de> for EventAttribute
impl<'de> Deserialize<'de> for EventAttribute
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventAttribute, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventAttribute, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for EventAttribute
Source§impl<K, V> From<(K, V)> for EventAttribute
impl<K, V> From<(K, V)> for EventAttribute
Source§fn from(_: (K, V)) -> EventAttribute
fn from(_: (K, V)) -> EventAttribute
Source§impl<K, V> From<(K, V, bool)> for EventAttribute
impl<K, V> From<(K, V, bool)> for EventAttribute
Source§fn from(_: (K, V, bool)) -> EventAttribute
fn from(_: (K, V, bool)) -> EventAttribute
Source§impl From<EventAttribute> for EventAttribute
impl From<EventAttribute> for EventAttribute
Source§fn from(msg: EventAttribute) -> EventAttribute
fn from(msg: EventAttribute) -> EventAttribute
Source§impl Hash for EventAttribute
impl Hash for EventAttribute
Source§impl PartialEq for EventAttribute
impl PartialEq for EventAttribute
Source§impl Serialize for EventAttribute
impl Serialize for EventAttribute
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for EventAttribute
Auto Trait Implementations§
impl Freeze for EventAttribute
impl RefUnwindSafe for EventAttribute
impl Send for EventAttribute
impl Sync for EventAttribute
impl Unpin for EventAttribute
impl UnsafeUnpin for EventAttribute
impl UnwindSafe for EventAttribute
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> Deprecatable for T
impl<T> Deprecatable for T
fn deprecate(self) -> Deprecated<Self>where
Self: Sized,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OptionalSet for T
impl<T> OptionalSet for T
Source§fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
Some), the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_validated_optional<F, T, V, E>(
self,
f: F,
value: Option<T>,
validate: V,
) -> Result<Self, E>
fn with_validated_optional<F, T, V, E>( self, f: F, value: Option<T>, validate: V, ) -> Result<Self, E>
Some) it is validated and then the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the FromStr implementation and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.Source§fn with_optional_custom_env<F, T, G>(
self,
f: F,
val: Option<T>,
env_var: &str,
parser: G,
) -> Self
fn with_optional_custom_env<F, T, G>( self, f: F, val: Option<T>, env_var: &str, parser: G, ) -> Self
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the provided parser and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.