#[repr(u8)]pub enum Nuc {
A = 1,
C = 2,
G = 4,
T = 8,
}Expand description
Concrete nucleotide
Nucs are ordered by the value of their ASCII representation.
Variants§
Implementations§
Source§impl Nuc
impl Nuc
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Sourcepub const fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>
pub const fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>
Construct from ASCII representation
§Errors
Returns ParseSymbolError if the given byte isn’t A, C, G or T
(case-insensitive).
§Examples
use nucs::Nuc;
assert_eq!(Nuc::from_ascii(b'A'), Ok(Nuc::A));
assert!(Nuc::from_ascii(b'B').is_err());Sourcepub const fn lit<const N: usize>(literal: &[u8; N]) -> [Nuc; N]
pub const fn lit<const N: usize>(literal: &[u8; N]) -> [Nuc; N]
Construct Nuc array from literal without allocating.
§Examples
use nucs::Nuc;
let dna1 = Nuc::lit(b"TACT");
// ...is shorthand for...
use Nuc::{T, A, C};
let dna2 = [T, A, C, T];
assert_eq!(dna1, dna2);§Panics
This panics if the supplied literal isn’t valid. Whitespace is NOT allowed because the returned array must have the same length.
Trait Implementations§
Source§impl BitOrAssign<&Nuc> for AmbiNuc
impl BitOrAssign<&Nuc> for AmbiNuc
Source§fn bitor_assign(&mut self, rhs: &Nuc)
fn bitor_assign(&mut self, rhs: &Nuc)
Performs the
|= operation. Read moreSource§impl BitOrAssign<Nuc> for AmbiNuc
impl BitOrAssign<Nuc> for AmbiNuc
Source§fn bitor_assign(&mut self, rhs: Nuc)
fn bitor_assign(&mut self, rhs: Nuc)
Performs the
|= operation. Read moreSource§impl Nucleotide for Nuc
impl Nucleotide for Nuc
Source§fn complement(self) -> Self
fn complement(self) -> Self
Return this nucleotide’s complement. Read more
Source§impl Ord for Nuc
impl Ord for Nuc
Source§impl PartialOrd<AmbiNuc> for Nuc
impl PartialOrd<AmbiNuc> for Nuc
Source§impl PartialOrd<Nuc> for AmbiNuc
impl PartialOrd<Nuc> for AmbiNuc
Source§impl PartialOrd for Nuc
impl PartialOrd for Nuc
Source§impl Symbol for Nuc
impl Symbol for Nuc
Source§fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>
fn from_ascii(ascii: u8) -> Result<Self, ParseSymbolError>
Construct from (case-insensitive) ASCII representation Read more
impl Copy for Nuc
impl Eq for Nuc
impl StructuralPartialEq for Nuc
Auto Trait Implementations§
impl Freeze for Nuc
impl RefUnwindSafe for Nuc
impl Send for Nuc
impl Sync for Nuc
impl Unpin for Nuc
impl UnwindSafe for Nuc
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