/// Owned contiguous byte array with an optional offset. /// /// Inspired by `bytes` crate's `Bytes`. #[derive(Debug, Clone)] pubstruct Bytes {
data: Vec<u8>,
offset: usize,
}
impl Bytes { /// Create a new `Bytes` with the given data and offset. /// /// # Panics /// /// Panics if `offset > data.len()`. #[must_use] pubfn new(data: Vec<u8>, offset: usize) -> Self {
assert!(
offset <= data.len(), "offset {offset} is out of bounds for data of length {}",
data.len()
); Self { data, offset }
}
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.