Struct LeafOp
pub struct LeafOp {
pub hash: i32,
pub prehash_key: i32,
pub prehash_value: i32,
pub length: i32,
pub prefix: Vec<u8>,
}
Expand description
LeafOp represents the raw key-value data we wish to prove, and must be flexible to represent the internal transformation from the original key-value pairs into the basis hash, for many existing merkle trees.
key and value are passed in. So that the signature of this operation is: leafOp(key, value) -> output
To process this, first prehash the keys and values if needed (ANY means no hash in this case): hkey = prehashKey(key) hvalue = prehashValue(value)
Then combine the bytes, and hash it output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)
Fields§
§hash: i32
§prehash_key: i32
§prehash_value: i32
§length: i32
§prefix: Vec<u8>
prefix is a fixed bytes that may optionally be included at the beginning to differentiate a leaf node from an inner node.
Implementations§
§impl LeafOp
impl LeafOp
pub fn hash(&self) -> HashOp
pub fn hash(&self) -> HashOp
Returns the enum value of hash
, or the default if the field is set to an invalid enum value.
pub fn prehash_key(&self) -> HashOp
pub fn prehash_key(&self) -> HashOp
Returns the enum value of prehash_key
, or the default if the field is set to an invalid enum value.
pub fn set_prehash_key(&mut self, value: HashOp)
pub fn set_prehash_key(&mut self, value: HashOp)
Sets prehash_key
to the provided enum value.
pub fn prehash_value(&self) -> HashOp
pub fn prehash_value(&self) -> HashOp
Returns the enum value of prehash_value
, or the default if the field is set to an invalid enum value.
pub fn set_prehash_value(&mut self, value: HashOp)
pub fn set_prehash_value(&mut self, value: HashOp)
Sets prehash_value
to the provided enum value.
pub fn length(&self) -> LengthOp
pub fn length(&self) -> LengthOp
Returns the enum value of length
, or the default if the field is set to an invalid enum value.
pub fn set_length(&mut self, value: LengthOp)
pub fn set_length(&mut self, value: LengthOp)
Sets length
to the provided enum value.
Trait Implementations§
§impl<'de> Deserialize<'de> for LeafOp
impl<'de> Deserialize<'de> for LeafOp
§fn deserialize<D>(
deserializer: D,
) -> Result<LeafOp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<LeafOp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Message for LeafOp
impl Message for LeafOp
§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.§impl Serialize for LeafOp
impl Serialize for LeafOp
§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 LeafOp
Auto Trait Implementations§
impl Freeze for LeafOp
impl RefUnwindSafe for LeafOp
impl Send for LeafOp
impl Sync for LeafOp
impl Unpin for LeafOp
impl UnwindSafe for LeafOp
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moreSource§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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered
].