use crate::{decode::*, wire::*};
use core::str::Utf8Error;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct WireLenRef<'a> {
pub data: &'a [u8],
}
impl<'a> WireLenRef<'a> {
#[inline]
pub fn as_bytes(&self) -> &[u8] {
self.data
}
#[inline]
pub fn try_as_string(&self) -> Result<&str, Utf8Error> {
core::str::from_utf8(self.data)
}
#[inline]
pub fn as_sub_msg(&self) -> MsgDecoder<'a> {
MsgDecoder {
wire_decoder: WireDecoder { data: self.data },
}
}
}