Skip to main content

Sampler

Struct Sampler 

Source
pub struct Sampler {
    pub actuation: ActuationPass,
    pub budget: Budget,
}
Expand description

A bounded without-replacement sampler composed from ActuationPass and Budget.

Fields§

§actuation: ActuationPass

Owner of support, selection, and applied effects.

§budget: Budget

Owner of the sample-size ceiling.

Implementations§

Source§

impl Sampler

Source

pub fn new(distribution: Vec<u64>, sample_size: usize) -> Self

Build the ActuationPass support projection and an empty sample Budget.

Source

pub fn weight(&self, item: usize) -> u64

Read one support weight, mapping ActuationPass’s absent allocation to zero.

Source

pub fn contains_exec(&self, item: usize) -> bool

Executable selected-membership projection.

Source

pub fn sample(&mut self, item: usize)

Couple ActuationPass.Actuate with Budget.TryAllocate(1).

Source

pub fn zero(&mut self, item: usize) -> bool

Withdraw an unselected support item through ActuationPass.Deallocate.

Source

pub fn draw_weighted(&mut self, item: usize, entropy: u64) -> bool

Weighted rejection over caller-supplied proposal and entropy.

Source

pub fn draw_uniform(&mut self, item: usize) -> bool

Uniform-support admission over a caller-supplied proposal.

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.