Enum tendermint::abci::EventAttribute

source ·
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

source

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.

source

pub fn key_bytes(&self) -> &[u8]

Access the key field common to all variants of the enum as bytes.

source

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.

source

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

pub fn index(&self) -> bool

Access the index field common to all variants of the enum.

source

pub fn set_index(&mut self, index: bool)

Set index field common to all variants of the enum.

source§

impl EventAttribute

source

pub fn eq_ignoring_index(&self, other: &Self) -> bool

Checks whether &self is equal to other, ignoring the index field.

source

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

source§

fn clone(&self) -> EventAttribute

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for EventAttribute

source§

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

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

impl<'de> Deserialize<'de> for EventAttribute

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<K: Into<String>, V: Into<String>> From<(K, V)> for EventAttribute

source§

fn from((key, value): (K, V)) -> Self

Converts to this type from the input type.
source§

impl<K: Into<String>, V: Into<String>> From<(K, V, bool)> for EventAttribute

source§

fn from((key, value, index): (K, V, bool)) -> Self

Converts to this type from the input type.
source§

impl Hash for EventAttribute

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for EventAttribute

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for EventAttribute

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for EventAttribute

source§

impl StructuralPartialEq for EventAttribute

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,