Trait bio_seq::codec::Codec

source ·
pub trait Codec: Copy + Clone + Into<u8> + PartialEq + Hash + Eq {
    type Error: Error + Display;

    const BITS: usize;

    // Required methods
    fn unsafe_from_bits(b: u8) -> Self;
    fn try_from_bits(b: u8) -> Result<Self, Self::Error>;
    fn from_char(c: char) -> Result<Self, Self::Error>;
    fn to_char(self) -> char;
}
Expand description

The binary encodings of an alphabet’s characters are represented with u8s. Encoding from UTF-8 or a raw u8 will always be fallible but often can be assumed safe.

Required Associated Types§

Required Associated Constants§

Required Methods§

source

fn unsafe_from_bits(b: u8) -> Self

source

fn try_from_bits(b: u8) -> Result<Self, Self::Error>

source

fn from_char(c: char) -> Result<Self, Self::Error>

source

fn to_char(self) -> char

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Codec for Amino

§

type Error = ParseBioError

source§

const BITS: usize = 6usize

source§

impl Codec for bio_seq::codec::dna::Dna

§

type Error = ParseBioError

source§

const BITS: usize = 2usize

source§

impl Codec for Iupac

§

type Error = ParseBioError

source§

const BITS: usize = 4usize

source§

impl Codec for bio_seq::codec::text::Dna

§

type Error = ParseBioError

source§

const BITS: usize = 8usize