na_nbt 0.2.1

High-performance NBT (Named Binary Tag) library with zero-copy parsing and serde support
Documentation
use std::ops::Deref;

use crate::{MUTF8Str, immutable::document::Document};

#[derive(Clone)]
pub struct ReadonlyString<'doc, D> {
    pub(crate) data: &'doc MUTF8Str,
    pub(crate) _doc: D,
}

impl<'doc, D: Document> Default for ReadonlyString<'doc, D> {
    #[inline]
    fn default() -> Self {
        Self {
            data: Default::default(),
            _doc: D::empty(),
        }
    }
}

impl<'doc, D: Document> Deref for ReadonlyString<'doc, D> {
    type Target = MUTF8Str;

    #[inline]
    fn deref(&self) -> &Self::Target {
        self.data
    }
}