MultiTrie

Struct MultiTrie 

Source
pub struct MultiTrie<T> { /* private fields */ }
Expand description

Struct used to store DLC outcome information for multi oracle cases.

Implementations§

Source§

impl<T> MultiTrie<T>

Source

pub fn new( oracle_numeric_infos: &OracleNumericInfo, nb_required: usize, min_support_exp: usize, max_error_exp: usize, maximize_coverage: bool, ) -> MultiTrie<T>

Create a new MultiTrie. Panics if nb_required is less or equal to zero, or if nb_tries is less than nb_required.

Source

pub fn insert_max_paths<F>(&mut self, get_value: &mut F) -> Result<(), Error>
where F: FnMut(&[Vec<usize>], &[usize]) -> Result<T, Error>,

Insert the paths to cover outcomes outside of the range of the oracle with minimum number of digits. Should only be called when oracles have varying number of digits.

Source

pub fn insert<F>( &mut self, path: &[usize], get_value: &mut F, ) -> Result<(), Error>
where F: FnMut(&[Vec<usize>], &[usize]) -> Result<T, Error>,

Insert the value returned by get_value at the position specified by path.

Source

pub fn look_up<'a>( &'a self, paths: &[(usize, Vec<usize>)], ) -> Option<(&'a T, Vec<(usize, Vec<usize>)>)>

Lookup in the trie for a value that matches with paths.

Source§

impl<T> MultiTrie<T>
where T: Clone,

Source

pub fn dump(&self) -> MultiTrieDump<T>

Dump the content of the trie for the purpose of serialization.

Source

pub fn from_dump(dump: MultiTrieDump<T>) -> MultiTrie<T>

Restore a trie from a dump.

Trait Implementations§

Source§

impl<T: Clone> Clone for MultiTrie<T>

Source§

fn clone(&self) -> MultiTrie<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> Freeze for MultiTrie<T>

§

impl<T> RefUnwindSafe for MultiTrie<T>
where T: RefUnwindSafe,

§

impl<T> Send for MultiTrie<T>
where T: Send,

§

impl<T> Sync for MultiTrie<T>
where T: Sync,

§

impl<T> Unpin for MultiTrie<T>
where T: Unpin,

§

impl<T> UnwindSafe for MultiTrie<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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