Struct TreeNode

Source
pub struct TreeNode {
    pub height: usize,
    pub leaves_count: i64,
    /* private fields */
}
Expand description

Node of a binary tree.

This binary tree implementation has limited functionality and is tailored specifically for the PathORAM use case.

Fields§

§height: usize§leaves_count: i64

Implementations§

Source§

impl TreeNode

Source

pub fn new(value: i64) -> Self

Source

pub fn create_tree(n: i64) -> TreeNode

Create and return a binary tree of the given size

§Invariants

n must be equal to (2^k)-1 for any k >= 0 In other words, n must be a power of two, minus one.

Source§

impl TreeNode

Source

pub fn is_leaf(&self) -> bool

Return true if this node is a leaf

Source

pub fn leaves(&mut self) -> Vec<i64>

Return the values of the leaves in the tree

Source

pub fn path_to_node(&self, x: i64) -> Vec<i64>

Return the nodes on the path from the root to the node with value x

Source

pub fn path(&mut self, x: i64) -> Arc<Vec<i64>>

Return the path from the root to the xth leaf (0-based). Path from leaf to root is called P(x) in Path ORAM

Source

pub fn pathl(&mut self, x: i64, level: usize) -> i64

Get the node at level l from the path from root to xth leaf (0-based) Also called P(x, l) in Path ORAM level=0 => root level=L => leaves

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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V