Symbol

Trait Symbol 

Source
pub trait Symbol:
    'static
    + Clone
    + Copy
    + Display
    + Debug
    + FromStr<Err = ParseSymbolError>
    + AsRef<Self>
    + AsMut<Self>
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + PartialEq<Self::Concrete>
    + PartialOrd<Self::Concrete>
    + PartialEq<Self::Ambiguous>
    + PartialOrd<Self::Ambiguous>
    + Into<Self::Ambiguous>
    + TryInto<Self::Concrete>
    + Hash
    + Sealed {
    type Concrete: Symbol;
    type Ambiguous: Symbol;

    // Required methods
    fn to_str(self) -> &'static str;
    fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>;
    fn to_ascii(self) -> u8;
    fn lit<const N: usize>(literal: &[u8; N]) -> [Self; N];
}
Expand description

A sequence element; either Nuc, AmbiNuc, Amino or AmbiAmino.

Required Associated Types§

Source

type Concrete: Symbol

Concrete symbols, i.e. Nuc or Amino

Source

type Ambiguous: Symbol

Ambiguous symbols, i.e. AmbiNuc or AmbiAmino

Required Methods§

Source

fn to_str(self) -> &'static str

Return uppercase string representation

Source

fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>

Construct from (case-insensitive) ASCII representation

§Errors

Returns ParseSymbolError if the given byte isn’t a valid (case-insensitive).

Source

fn to_ascii(self) -> u8

Return uppercase ASCII representation

Source

fn lit<const N: usize>(literal: &[u8; N]) -> [Self; N]

Construct array from literal without allocating.

This is just intended to be a convenience method for testing.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§