Skip to main content

LazyWfstWrapper

Struct LazyWfstWrapper 

Source
pub struct LazyWfstWrapper<S, L, W>
where S: StateSource<L, W>, W: Semiring,
{ /* private fields */ }
Expand description

Generic lazy WFST wrapper that computes states on demand.

Wraps a StateSource and caches computed states according to the configured CachePolicy.

§Type Parameters

  • S: The state source type
  • L: Label type
  • W: Weight type

Implementations§

Source§

impl<S, L, W> LazyWfstWrapper<S, L, W>
where S: StateSource<L, W>, L: Clone + Send + Sync, W: Semiring,

Source

pub fn new(source: S) -> LazyWfstWrapper<S, L, W>

Create a new lazy WFST with default caching.

Source

pub fn with_cache_policy( source: S, policy: CachePolicy, ) -> LazyWfstWrapper<S, L, W>

Create with a specific cache policy.

Source

pub fn source(&self) -> &S

Get the underlying source.

Source

pub fn source_mut(&mut self) -> &mut S

Get mutable access to the underlying source.

Source

pub fn into_source(self) -> S

Take ownership of the source, discarding the cache.

Trait Implementations§

Source§

impl<S, L, W> Clone for LazyWfstWrapper<S, L, W>
where S: StateSource<L, W> + Clone, L: Clone, W: Semiring,

Source§

fn clone(&self) -> LazyWfstWrapper<S, L, W>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S, L, W> Debug for LazyWfstWrapper<S, L, W>
where S: Debug + StateSource<L, W>, L: Debug, W: Debug + Semiring,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S, L, W> LazyWfst<L, W> for LazyWfstWrapper<S, L, W>
where S: StateSource<L, W>, L: Clone + Send + Sync, W: Semiring,

Source§

fn is_expanded(&self, state: u32) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: u32)

Force expansion of a state. Read more
Source§

fn transitions_lazy(&mut self, state: u32) -> &[WeightedTransition<L, W>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl<S, L, W> Wfst<L, W> for LazyWfstWrapper<S, L, W>
where S: StateSource<L, W>, L: Clone + Send + Sync, W: Semiring,

Source§

fn start(&self) -> u32

Get the start state ID.
Source§

fn is_final(&self, state: u32) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: u32) -> W

Get the final weight for a state. Read more
Source§

fn transitions(&self, state: u32) -> &[WeightedTransition<L, W>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_valid_state(&self, state: u32) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.

Auto Trait Implementations§

§

impl<S, L, W> Freeze for LazyWfstWrapper<S, L, W>
where S: Freeze,

§

impl<S, L, W> RefUnwindSafe for LazyWfstWrapper<S, L, W>

§

impl<S, L, W> Send for LazyWfstWrapper<S, L, W>
where L: Send,

§

impl<S, L, W> Sync for LazyWfstWrapper<S, L, W>
where L: Sync,

§

impl<S, L, W> Unpin for LazyWfstWrapper<S, L, W>
where S: Unpin, W: Unpin, L: Unpin,

§

impl<S, L, W> UnsafeUnpin for LazyWfstWrapper<S, L, W>
where S: UnsafeUnpin,

§

impl<S, L, W> UnwindSafe for LazyWfstWrapper<S, L, W>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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