[][src]Struct warkov::MarkovChain

pub struct MarkovChain<T, R> where
    T: Hash + Eq + Clone + Default + Ord + Debug,
    R: Rng
{ /* fields omitted */ }

A Markov Chain.

Implementations

impl<T> MarkovChain<T, ThreadRng> where
    T: Hash + Eq + Clone + Default + Ord + Debug
[src]

pub fn new(size: usize) -> Self[src]

Creates a MarkovChain with the max look a head size. Uses the stock thread local random number generator

Panics

If size is 0.

impl<T, R> MarkovChain<T, R> where
    T: Hash + Eq + Clone + Default + Ord + Debug,
    R: Rng
[src]

pub fn new_with_rng(size: usize, rng: R) -> Self[src]

Creates a MarkovChain with the specified random number generator, and max look a head size

Panics

If size is 0.

pub fn set_rng(&mut self, rng: R)[src]

Change the random number generation for this object to rng.

pub fn train(&mut self, term: impl Iterator<Item = T>)[src]

Teach the markov chain this term.

pub fn generate(&mut self) -> Vec<T>[src]

Generates a term. Uses the lookbehind value this was created with.

pub fn generate_max_look(&mut self, max_lookbehind: usize) -> Vec<T>[src]

Generates a new term with a custom lookbehind.

Panics

If max_lookbehind is 0 or greater than the lookbehind this was created with.

Trait Implementations

impl<T: Default, R: Default> Default for MarkovChain<T, R> where
    T: Hash + Eq + Clone + Default + Ord + Debug,
    R: Rng
[src]

Auto Trait Implementations

impl<T, R> RefUnwindSafe for MarkovChain<T, R> where
    R: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, R> Send for MarkovChain<T, R> where
    R: Send,
    T: Send

impl<T, R> Sync for MarkovChain<T, R> where
    R: Sync,
    T: Sync

impl<T, R> Unpin for MarkovChain<T, R> where
    R: Unpin,
    T: Unpin

impl<T, R> UnwindSafe for MarkovChain<T, R> where
    R: UnwindSafe,
    T: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.