pub struct OwnedFB<T> { /* private fields */ }Expand description
Stores the owned bytes of the flatbuffer type and can access the actual type.
Implementations§
Source§impl<T> OwnedFB<T>
impl<T> OwnedFB<T>
pub fn new<'a>(buf: &'a [u8]) -> Result<OwnedFB<T>, InvalidFlatbuffer>where
T: Verifiable + Follow<'a> + 'a,
Sourcepub unsafe fn new_from_vec_unchecked(buf: Vec<u8>, index: usize) -> Self
pub unsafe fn new_from_vec_unchecked(buf: Vec<u8>, index: usize) -> Self
§Safety
Caller is responsible for verifying the buffer and align the type T.
Sourcepub unsafe fn new_from_builder_collapse(pair: (Vec<u8>, usize)) -> Self
pub unsafe fn new_from_builder_collapse(pair: (Vec<u8>, usize)) -> Self
§Safety
Caller is responsible for verifying the buffer and align the type T.
pub fn new_from_vec(
buf: Vec<u8>,
index: usize,
) -> Result<OwnedFB<T>, InvalidFlatbuffer>where
T: Verifiable + Follow<'static> + 'static,
Sourcepub fn new_from_bytes(buf: Bytes) -> Result<OwnedFB<T>, InvalidFlatbuffer>where
T: Verifiable + Follow<'static> + 'static,
pub fn new_from_bytes(buf: Bytes) -> Result<OwnedFB<T>, InvalidFlatbuffer>where
T: Verifiable + Follow<'static> + 'static,
This in practice is not zero copy for tonic.
pub fn get_ref<'a>(&'a self) -> <T as Follow<'a>>::Innerwhere
T: Follow<'a>,
pub fn get_slice(&self) -> &[u8] ⓘ
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
This may be zero copy if the vec capacity equals to length and index is zero.
Auto Trait Implementations§
impl<T> Freeze for OwnedFB<T>
impl<T> RefUnwindSafe for OwnedFB<T>where
T: RefUnwindSafe,
impl<T> Send for OwnedFB<T>where
T: Send,
impl<T> Sync for OwnedFB<T>where
T: Sync,
impl<T> Unpin for OwnedFB<T>where
T: Unpin,
impl<T> UnwindSafe for OwnedFB<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more