/// A string that only contains ASCII characters, same layout as [`str`]. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] pubstruct AsciiStr([AsciiChar]);
let src = src.as_bytes(); letmut result = [AsciiChar::NULL; N]; letmut i = 0; while i < src.len() {
result[i] = AsciiChar::new(src[i]);
i += 1;
}
result
}
#[inline] pubconstfn from_slice(src: &[AsciiChar]) -> &Self { // SAFETY: `Self` is transparent over `[AsciiChar]`. unsafe { core::mem::transmute::<&[AsciiChar], &AsciiStr>(src) }
}
#[inline] pubconstfn as_str(&self) -> &str { // SAFETY: `Self` has the same layout as `str`, // and all ASCII characters are valid UTF-8 characters. unsafe { core::mem::transmute::<&AsciiStr, &str>(self) }
}
if d >= ALPHABET.len().pow(2) as u32 {
panic!();
}
[ Self::new(ALPHABET[d as usize / ALPHABET.len()]), Self::new(ALPHABET[d as usize % ALPHABET.len()]),
]
}
if d >= ALPHABET.len().pow(2) as u32 {
panic!();
}
[ Self::new(ALPHABET[d as usize / ALPHABET.len()]), Self::new(ALPHABET[d as usize % ALPHABET.len()]),
]
}
}
mod _ascii_char { /// A character that is known to be in ASCII range, same layout as [`u8`]. #[derive(Debug, Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] pubstruct AsciiChar(u8);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.