Skip to main content

Profile

Struct Profile 

Source
pub struct Profile {
Show 17 fields pub profile_id: String, pub mode: Mode, pub body_alphabet: String, pub body_length: usize, pub min_length: Option<usize>, pub checksum_alphabet: String, pub checksum_length: usize, pub short_checksum_length: usize, pub short_checksum_until: usize, pub case_sensitive: bool, pub separator: String, pub separator_min_length: usize, pub grouping: Vec<usize>, pub aliases: Vec<(char, char)>, pub permutation: Permutation, pub profanity: Option<Profanity>, pub max_repetition: usize,
}
Expand description

A baseH profile. Construct one, pass it to crate::Baseh::new and keep the resulting codec. Profiles are validated at construction per spec 2.2.

aliases is a list of (source, target) pairs rather than a map so that duplicate sources (including duplicates that only collide after case normalization) can be detected during validation.

Fields§

§profile_id: String§mode: Mode

Fixed keeps the classic constant-width behaviour; expandable gives variable-length codes driven by id magnitude (spec 19).

§body_alphabet: String§body_length: usize

Fixed mode only; ignored in expandable mode.

§min_length: Option<usize>

Expandable mode only; None selects the default of 4. When set it must be a positive integer exceeding checksum_length.

§checksum_alphabet: String§checksum_length: usize§short_checksum_length: usize

Spec 22. Expandable mode only. The checksum width used by generations at or below short_checksum_until; may be 0 (a zero-checksum window: those generations carry no checksum symbols and no typo detection). Without a window (short_checksum_until of 0) this must be 0.

§short_checksum_until: usize

Spec 22. The last generation (total length) that uses the short checksum; 0 (the default) turns the feature off (the codebase convention, like max_repetition). When set it must be an integer from min_length through 8.

§case_sensitive: bool§separator: String§separator_min_length: usize

Expandable mode only; 0 (the default) means the separator always applies. Must be 0 in fixed mode.

§grouping: Vec<usize>§aliases: Vec<(char, char)>§permutation: Permutation§profanity: Option<Profanity>§max_repetition: usize

Spec 21. Maximum allowed run of the same symbol in a raw code. 0 (the default) disables the filter; otherwise it must be at least 3. A value above the code length is a legal no-op.

Trait Implementations§

Source§

impl Clone for Profile

Source§

fn clone(&self) -> Profile

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 Debug for Profile

Source§

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

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

impl Eq for Profile

Source§

impl PartialEq for Profile

Source§

fn eq(&self, other: &Profile) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Profile

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.