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: &Self) -> bool
pub fn eq_ignoring_index(&self, other: &Self) -> bool
Checks whether &self
is equal to other
, ignoring the index
field.
Sourcepub fn hash_ignoring_index<H: Hasher>(&self, state: &mut H)
pub fn hash_ignoring_index<H: Hasher>(&self, state: &mut H)
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more