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

Returns whether the exclusion leaf is the Leaf variant.

Returns

  • [bool] - true if this is a Leaf, otherwise false.

Examples

use sway_libs::merkle::sparse::ExclusionLeaf;

fn foo(exclusion_leaf: ExclusionLeaf) {
    assert(exclusion_leaf.is_leaf());
}

pub fn is_placeholder(self) -> bool

Returns whether the exclusion leaf is the Placeholder variant.

Returns

  • [bool] - true if this is a Placeholder, otherwise false.

Examples

use sway_libs::merkle::sparse::ExclusionLeaf;

fn foo(exclusion_leaf: ExclusionLeaf) {
    assert(exclusion_leaf.is_placeholder());
}

pub fn as_leaf(self) -> Option<ExclusionLeafData>

Returns the exclusion leaf as the Leaf variant.

Returns

  • [Option] - Some if this is a Leaf, otherwise None.

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

pub fn abi_encode(self, buffer: Buffer) -> Buffer

pub fn abi_decode(refmut buffer: BufferReader) -> Self

pub fn eq(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, otherwise false.

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);
}