pub struct SymbolBijection<A: SerialAlphabet> { /* private fields */ }Expand description
A caller-defined, validated bijection between two finite alphabets.
Implementations§
Source§impl<A: SerialAlphabet> SymbolBijection<A>
impl<A: SerialAlphabet> SymbolBijection<A>
Sourcepub fn try_new<I>(
source: A,
target: A,
pairs: I,
) -> Result<Self, SymbolBijectionError>
pub fn try_new<I>( source: A, target: A, pairs: I, ) -> Result<Self, SymbolBijectionError>
Validates a complete symbol-pair bijection from source to target.
Sourcepub fn cyclic(alphabet: A, steps: usize) -> Result<Self, SymbolBijectionError>
pub fn cyclic(alphabet: A, steps: usize) -> Result<Self, SymbolBijectionError>
Constructs a cyclic relabeling over one alphabet’s canonical order.
Sourcepub fn source_to_target(&self) -> &[usize]
pub fn source_to_target(&self) -> &[usize]
Returns the validated source-position to target-position bijection.
Sourcepub fn map_symbol(
&self,
symbol: &A::Symbol,
) -> Result<A::Symbol, SymbolBijectionError>
pub fn map_symbol( &self, symbol: &A::Symbol, ) -> Result<A::Symbol, SymbolBijectionError>
Maps one source symbol to its target symbol.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Returns whether symbols and alphabet identity are unchanged.
Sourcepub fn inverse(&self) -> Result<Self, SymbolBijectionError>
pub fn inverse(&self) -> Result<Self, SymbolBijectionError>
Returns the exact inverse bijection.
Sourcepub fn compose(&self, next: &Self) -> Result<Self, SeriesTransformError>
pub fn compose(&self, next: &Self) -> Result<Self, SeriesTransformError>
Composes self followed by next.
Sourcepub fn canonical_form(&self) -> String
pub fn canonical_form(&self) -> String
Returns the deterministic identity-and-ordinal representation.
Trait Implementations§
Source§impl<A: Clone + SerialAlphabet> Clone for SymbolBijection<A>
impl<A: Clone + SerialAlphabet> Clone for SymbolBijection<A>
Source§fn clone(&self) -> SymbolBijection<A>
fn clone(&self) -> SymbolBijection<A>
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<A: Debug + SerialAlphabet> Debug for SymbolBijection<A>
impl<A: Debug + SerialAlphabet> Debug for SymbolBijection<A>
impl<A: Eq + SerialAlphabet> Eq for SymbolBijection<A>
Source§impl<A: PartialEq + SerialAlphabet> PartialEq for SymbolBijection<A>
impl<A: PartialEq + SerialAlphabet> PartialEq for SymbolBijection<A>
impl<A: PartialEq + SerialAlphabet> StructuralPartialEq for SymbolBijection<A>
Auto Trait Implementations§
impl<A> Freeze for SymbolBijection<A>where
A: Freeze,
impl<A> RefUnwindSafe for SymbolBijection<A>where
A: RefUnwindSafe,
impl<A> Send for SymbolBijection<A>where
A: Send,
impl<A> Sync for SymbolBijection<A>where
A: Sync,
impl<A> Unpin for SymbolBijection<A>where
A: Unpin,
impl<A> UnsafeUnpin for SymbolBijection<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for SymbolBijection<A>where
A: UnwindSafe,
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