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 typeL: Label typeW: Weight type
Implementations§
Source§impl<S, L, W> LazyWfstWrapper<S, L, W>
impl<S, L, W> LazyWfstWrapper<S, L, W>
Sourcepub fn new(source: S) -> LazyWfstWrapper<S, L, W>
pub fn new(source: S) -> LazyWfstWrapper<S, L, W>
Create a new lazy WFST with default caching.
Sourcepub fn with_cache_policy(
source: S,
policy: CachePolicy,
) -> LazyWfstWrapper<S, L, W>
pub fn with_cache_policy( source: S, policy: CachePolicy, ) -> LazyWfstWrapper<S, L, W>
Create with a specific cache policy.
Sourcepub fn source_mut(&mut self) -> &mut S
pub fn source_mut(&mut self) -> &mut S
Get mutable access to the underlying source.
Sourcepub fn into_source(self) -> S
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>
impl<S, L, W> Clone for LazyWfstWrapper<S, L, W>
Source§fn clone(&self) -> LazyWfstWrapper<S, L, W>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S, L, W> Debug for LazyWfstWrapper<S, L, W>
impl<S, L, W> Debug for LazyWfstWrapper<S, L, W>
Source§impl<S, L, W> LazyWfst<L, W> for LazyWfstWrapper<S, L, W>
impl<S, L, W> LazyWfst<L, W> for LazyWfstWrapper<S, L, W>
Source§fn is_expanded(&self, state: u32) -> bool
fn is_expanded(&self, state: u32) -> bool
Check if a state has been expanded (transitions computed).
Source§fn transitions_lazy(&mut self, state: u32) -> &[WeightedTransition<L, W>]
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
fn cache_policy(&self) -> CachePolicy
Get the current cache policy.
Source§fn set_cache_policy(&mut self, policy: CachePolicy)
fn set_cache_policy(&mut self, policy: CachePolicy)
Set the cache policy.
Source§fn computed_states(&self) -> usize
fn computed_states(&self) -> usize
Get the number of states that have been computed so far.
Source§fn clear_cache(&mut self)
fn clear_cache(&mut self)
Clear the state cache. Read more
Source§impl<S, L, W> Wfst<L, W> for LazyWfstWrapper<S, L, W>
impl<S, L, W> Wfst<L, W> for LazyWfstWrapper<S, L, W>
Source§fn final_weight(&self, state: u32) -> W
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>]
fn transitions(&self, state: u32) -> &[WeightedTransition<L, W>]
Get the outgoing transitions from a state. Read more
Source§fn num_states(&self) -> usize
fn num_states(&self) -> usize
Get the number of states in the transducer.
Source§fn is_valid_state(&self, state: u32) -> bool
fn is_valid_state(&self, state: u32) -> bool
Check if a state ID is valid.
Source§fn num_transitions(&self, state: u32) -> usize
fn num_transitions(&self, state: u32) -> usize
Get the number of transitions from a state.
Source§fn total_transitions(&self) -> usize
fn total_transitions(&self) -> usize
Get total number of transitions in the transducer.
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>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more