Transducerdp

Struct Transducerdp 

Source
pub struct Transducerdp<M, T, C>
where M: Monoid, T: Transducer, C: Container<Key = T::State, Value = M::T>,
{ fst: T, pub dp: C, ndp: C, _marker: PhantomData<fn() -> M>, }

Fields§

§fst: T§dp: C§ndp: C§_marker: PhantomData<fn() -> M>

Implementations§

Source§

impl<M, T, C> Transducerdp<M, T, C>
where M: Monoid, T: Transducer, C: Container<Key = T::State, Value = M::T>,

Source

pub fn new<F>(fst: T, init: M::T, factory: F) -> Self
where F: ContainerFactory<Container = C>,

Examples found in repository?
crates/competitive/src/data_structure/transducer.rs (line 106)
102    pub fn with_factory<F>(self, factory: F) -> Transducerdp<M, A, F::Container>
103    where
104        F: ContainerFactory<Container: Container<Key = A::State, Value = M::T>>,
105    {
106        Transducerdp::new(self.fst, self.init, factory)
107    }
Source

pub fn step<S, I, B>(&mut self, sigma: S)
where S: FnMut() -> I, I: IntoIterator<Item = B>, B: Borrow<T::Input>,

Examples found in repository?
crates/competitive/src/data_structure/transducer.rs (line 253)
246    pub fn run<S, I, B>(&mut self, mut sigma: S, len: usize) -> M::T
247    where
248        S: FnMut() -> I,
249        I: IntoIterator<Item = B>,
250        B: Borrow<T::Input>,
251    {
252        for _ in 0..len {
253            self.step(&mut sigma);
254        }
255        self.fold_accept()
256    }
Source

pub fn step_effect<S, I, B, F>(&mut self, sigma: S, effect: F)
where S: FnMut() -> I, I: IntoIterator<Item = B>, B: Borrow<T::Input>, F: FnMut(&M::T, &T::Output) -> M::T,

Examples found in repository?
crates/competitive/src/data_structure/transducer.rs (line 265)
257    pub fn run_effect<S, I, B, F>(&mut self, mut sigma: S, len: usize, mut effect: F) -> M::T
258    where
259        S: FnMut() -> I,
260        I: IntoIterator<Item = B>,
261        B: Borrow<T::Input>,
262        F: FnMut(&M::T, &T::Output) -> M::T,
263    {
264        for _ in 0..len {
265            self.step_effect(&mut sigma, &mut effect);
266        }
267        self.fold_accept()
268    }
Source

pub fn fold_accept(&self) -> M::T

Examples found in repository?
crates/competitive/src/data_structure/transducer.rs (line 255)
246    pub fn run<S, I, B>(&mut self, mut sigma: S, len: usize) -> M::T
247    where
248        S: FnMut() -> I,
249        I: IntoIterator<Item = B>,
250        B: Borrow<T::Input>,
251    {
252        for _ in 0..len {
253            self.step(&mut sigma);
254        }
255        self.fold_accept()
256    }
257    pub fn run_effect<S, I, B, F>(&mut self, mut sigma: S, len: usize, mut effect: F) -> M::T
258    where
259        S: FnMut() -> I,
260        I: IntoIterator<Item = B>,
261        B: Borrow<T::Input>,
262        F: FnMut(&M::T, &T::Output) -> M::T,
263    {
264        for _ in 0..len {
265            self.step_effect(&mut sigma, &mut effect);
266        }
267        self.fold_accept()
268    }
Source

pub fn map_fold_accept<U, F, D>(&self, f: F, map: D) -> D
where F: FnMut(&T::State) -> U, D: Container<Key = U, Value = M::T>,

Source

pub fn run<S, I, B>(&mut self, sigma: S, len: usize) -> M::T
where S: FnMut() -> I, I: IntoIterator<Item = B>, B: Borrow<T::Input>,

Source

pub fn run_effect<S, I, B, F>( &mut self, sigma: S, len: usize, effect: F, ) -> M::T
where S: FnMut() -> I, I: IntoIterator<Item = B>, B: Borrow<T::Input>, F: FnMut(&M::T, &T::Output) -> M::T,

Trait Implementations§

Source§

impl<M, T, C> Clone for Transducerdp<M, T, C>
where M: Monoid + Clone, T: Transducer + Clone, C: Container<Key = T::State, Value = M::T> + Clone,

Source§

fn clone(&self) -> Transducerdp<M, T, C>

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
Source§

impl<M, T, C> Debug for Transducerdp<M, T, C>
where M: Monoid<T: Debug>, T: Transducer<State: Debug> + Debug, C: Container<Key = T::State, Value = M::T> + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M, T, C> Freeze for Transducerdp<M, T, C>
where T: Freeze, C: Freeze,

§

impl<M, T, C> RefUnwindSafe for Transducerdp<M, T, C>

§

impl<M, T, C> Send for Transducerdp<M, T, C>
where T: Send, C: Send,

§

impl<M, T, C> Sync for Transducerdp<M, T, C>
where T: Sync, C: Sync,

§

impl<M, T, C> Unpin for Transducerdp<M, T, C>
where T: Unpin, C: Unpin,

§

impl<M, T, C> UnwindSafe for Transducerdp<M, T, C>
where T: UnwindSafe, C: 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.