use alloc::{string::String, vec::Vec};
pub trait FromBytes {
fn from_bytes(bytes: &[u8]) -> crate::Result<Self>
where
Self: Sized;
}
impl FromBytes for String {
#[inline]
fn from_bytes(bytes: &[u8]) -> crate::Result<Self>
where
Self: Sized,
{
Ok(core::str::from_utf8(bytes)?.into())
}
}
impl FromBytes for Vec<u8> {
#[inline]
fn from_bytes(bytes: &[u8]) -> crate::Result<Self>
where
Self: Sized,
{
Ok(bytes.into())
}
}