CrushMap

Struct CrushMap 

Source
#[repr(transparent)]
pub struct CrushMap { pub ptr: *mut crush_map, }

Fields§

§ptr: *mut crush_map

Implementations§

Source§

impl CrushMap

Source

pub fn new() -> Self

Source

pub fn new_legacy() -> Self

Source

pub fn choose_local_tries(&self) -> u32

Source

pub fn choose_local_fallback_tries(&self) -> u32

Source

pub fn choose_total_tries(&self) -> u32

Source

pub fn chooseleaf_descend_once(&self) -> u32

Source

pub fn chooseleaf_vary_r(&self) -> u8

Source

pub fn chooseleaf_stable(&self) -> u8

Source

pub fn straw_calc_version(&self) -> u8

Source

pub fn allowed_bucket_algs(&self) -> u32

Source

pub fn has_rules(&self) -> bool

Source

pub fn max_buckets(&self) -> i32

Source

pub fn make_bucket( &mut self, alg: BucketAlgorithm, hash: i32, type_: i32, items: &[i32], weights: &[i32], ) -> Result<Bucket, &'static str>

Source

pub fn add_bucket(&mut self, id: i32, bucket: Bucket) -> Result<i32, i32>

Source

pub fn find_roots(&self) -> Result<Vec<i32>, i32>

Source

pub fn finalize(&mut self)

Source

pub fn make_choose_args(&self, num_positions: i32) -> ChooseArgs

Source

pub fn add_rule(&mut self, rule: Rule, ruleno: i32) -> i32

Source

pub fn do_rule( &self, ruleno: i32, x: i32, result: &mut [i32], weights: &[u32], choose_args: Option<&ChooseArgs>, ) -> Result<usize, &'static str>

Trait Implementations§

Source§

impl Default for CrushMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for CrushMap

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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