Enum sway_libs::merkle::sparse::ExclusionLeaf
pub enum ExclusionLeaf {
/// Data for the exclusion proof leaf.
Leaf: ExclusionLeafData,
/// A placeholder for no data.
Placeholder: (),
}
Expand description
An Exclusion Proof Leaf for a Sparse Merkle Tree.
Variants
Leaf: ExclusionLeafData
Data for the exclusion proof leaf.
Placeholder: ()
A placeholder for no data.
Implementations
pub fn is_leaf(self) -> bool
pub fn is_leaf(self) -> bool
Returns whether the exclusion leaf is the Leaf
variant.
Returns
- [bool] -
true
if this is aLeaf
, otherwisefalse
.
Examples
use sway_libs::merkle::sparse::ExclusionLeaf;
fn foo(exclusion_leaf: ExclusionLeaf) {
assert(exclusion_leaf.is_leaf());
}
pub fn is_placeholder(self) -> bool
pub fn is_placeholder(self) -> bool
Returns whether the exclusion leaf is the Placeholder
variant.
Returns
- [bool] -
true
if this is aPlaceholder
, otherwisefalse
.
Examples
use sway_libs::merkle::sparse::ExclusionLeaf;
fn foo(exclusion_leaf: ExclusionLeaf) {
assert(exclusion_leaf.is_placeholder());
}
pub fn as_leaf(self) -> Option<ExclusionLeafData>
pub fn as_leaf(self) -> Option<ExclusionLeafData>
Returns the exclusion leaf as the Leaf
variant.
Returns
- [Option] -
Some
if this is aLeaf
, otherwiseNone
.
Examples
use sway_libs::merkle::sparse::{ExclusionLeaf, ExclusionLeafData};
fn foo(exclusion_leaf: ExclusionLeaf) {
let leaf = exclusion_leaf.as_leaf();
assert(leaf.leaf_value != b256::zero());
}
Trait Implementations
impl AbiEncode for ExclusionLeaf
impl AbiEncode for ExclusionLeaf
pub fn abi_encode(self, buffer: Buffer) -> Buffer
impl AbiDecode for ExclusionLeaf
impl AbiDecode for ExclusionLeaf
pub fn abi_decode(refmut buffer: BufferReader) -> Self
impl PartialEq for ExclusionLeaf
impl PartialEq for ExclusionLeaf
pub fn eq(self, other: Self) -> bool
pub fn neq(self, other: Self) -> bool
pub fn neq(self, other: Self) -> bool
Evaluates if two values of the same type are not equal.
Additional Information
This function is inherited when eq()
is implemented.
Arguments
other
: [Self] - The value of the same type.
Returns
- [bool] -
true
if the two values are not equal, otherwisefalse
.
Examples
struct MyStruct {
val: u64,
}
impl PartialEq for MyStruct {
fn eq(self, other: Self) -> bool {
self.val == other.val
}
}
fn foo() {
let struct1 = MyStruct { val: 10 };
let struct2 = MyStruct { val: 2 };
let result = struct1 != struct2;
assert(result);
}