use alloc::vec::Vec;
use crate::bstr::BStr;
#[derive(Clone, Hash)]
pub struct BString {
bytes: Vec<u8>,
}
impl BString {
#[inline]
pub const fn new(bytes: Vec<u8>) -> BString {
BString { bytes }
}
#[inline]
pub(crate) fn as_bytes(&self) -> &[u8] {
&self.bytes
}
#[inline]
pub(crate) fn as_bytes_mut(&mut self) -> &mut [u8] {
&mut self.bytes
}
#[inline]
pub(crate) fn as_bstr(&self) -> &BStr {
BStr::new(&self.bytes)
}
#[inline]
pub(crate) fn as_mut_bstr(&mut self) -> &mut BStr {
BStr::new_mut(&mut self.bytes)
}
#[inline]
pub(crate) fn as_vec(&self) -> &Vec<u8> {
&self.bytes
}
#[inline]
pub(crate) fn as_vec_mut(&mut self) -> &mut Vec<u8> {
&mut self.bytes
}
#[inline]
pub(crate) fn into_vec(self) -> Vec<u8> {
self.bytes
}
}