Struct microkelvin::TokenBuffer
source · [−]pub struct TokenBuffer { /* private fields */ }
Expand description
Writebuffer guarded by a Token
Implementations
sourceimpl TokenBuffer
impl TokenBuffer
sourcepub fn new(token: Token, buffer: &mut [u8]) -> Self
pub fn new(token: Token, buffer: &mut [u8]) -> Self
Construct a new TokenBuffer
from a mutable slice of bytes and a token
sourcepub fn written_bytes(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn written_bytes(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Return bytes that have been written into the tokenbuffer
sourcepub unsafe fn unwritten_bytes(&mut self) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub unsafe fn unwritten_bytes(&mut self) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Return bytes that have not yet been written
Safety
It is up to the caller to assure that Only one mutable reference may exist at a time
Trait Implementations
sourceimpl Fallible for TokenBuffer
impl Fallible for TokenBuffer
type Error = BufferOverflow
type Error = BufferOverflow
The error produced by any failing methods.
sourceimpl Serializer for TokenBuffer
impl Serializer for TokenBuffer
sourcefn write(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
Attempts to write the given bytes to the serializer.
sourcefn pad(&mut self, padding: usize) -> Result<(), Self::Error>
fn pad(&mut self, padding: usize) -> Result<(), Self::Error>
Advances the given number of bytes as padding.
sourcefn align(&mut self, align: usize) -> Result<usize, Self::Error>
fn align(&mut self, align: usize) -> Result<usize, Self::Error>
Aligns the position of the serializer to the given alignment.
sourcefn align_for<T>(&mut self) -> Result<usize, Self::Error>
fn align_for<T>(&mut self) -> Result<usize, Self::Error>
Aligns the position of the serializer to be suitable to write the given type.
sourceunsafe fn resolve_aligned<T>(
&mut self,
value: &T,
resolver: <T as Archive>::Resolver
) -> Result<usize, Self::Error> where
T: Archive + ?Sized,
unsafe fn resolve_aligned<T>(
&mut self,
value: &T,
resolver: <T as Archive>::Resolver
) -> Result<usize, Self::Error> where
T: Archive + ?Sized,
Resolves the given value with its resolver and writes the archived type. Read more
sourcefn serialize_value<T>(&mut self, value: &T) -> Result<usize, Self::Error> where
T: Serialize<Self>,
fn serialize_value<T>(&mut self, value: &T) -> Result<usize, Self::Error> where
T: Serialize<Self>,
Archives the given object and returns the position it was archived at.
sourceunsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
metadata_resolver: <T as ArchiveUnsized>::MetadataResolver
) -> Result<usize, Self::Error> where
T: ArchiveUnsized + ?Sized,
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
metadata_resolver: <T as ArchiveUnsized>::MetadataResolver
) -> Result<usize, Self::Error> where
T: ArchiveUnsized + ?Sized,
Resolves the given reference with its resolver and writes the archived reference. Read more
sourcefn serialize_unsized_value<T>(
&mut self,
value: &T
) -> Result<usize, Self::Error> where
T: SerializeUnsized<Self> + ?Sized,
fn serialize_unsized_value<T>(
&mut self,
value: &T
) -> Result<usize, Self::Error> where
T: SerializeUnsized<Self> + ?Sized,
Archives a reference to the given object and returns the position it was archived at.
Auto Trait Implementations
impl RefUnwindSafe for TokenBuffer
impl !Send for TokenBuffer
impl !Sync for TokenBuffer
impl Unpin for TokenBuffer
impl UnwindSafe for TokenBuffer
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more