#[repr(C)]pub struct ReadStatBufferCtx<'a> {
data: *const u8,
len: usize,
pos: usize,
_marker: PhantomData<&'a [u8]>,
}Expand description
In-memory buffer context for ReadStat I/O callbacks.
Wraps a borrowed byte slice and tracks the current read position.
Passed as the io_ctx pointer to all I/O handler callbacks.
The 'a lifetime ties the context to the borrowed byte slice so the
compiler enforces that the buffer outlives the context (and therefore any
parse driven through it). The trailing PhantomData carries that lifetime
without changing the C-visible layout — it is zero-sized, so the #[repr(C)]
field order seen from C (data, len, pos) is unaffected.
Fields§
§data: *const u8§len: usize§pos: usize§_marker: PhantomData<&'a [u8]>Implementations§
Source§impl<'a> ReadStatBufferCtx<'a>
impl<'a> ReadStatBufferCtx<'a>
Sourcepub const fn new(bytes: &'a [u8]) -> Self
pub const fn new(bytes: &'a [u8]) -> Self
Creates a new buffer context from a byte slice.
The returned context borrows bytes; the borrow checker guarantees the
slice outlives the context and any parsing operations that use it.
Sourcepub fn configure_parser(
&mut self,
parser: ReadStatParser,
) -> Result<ReadStatParser, ReadStatError>
pub fn configure_parser( &mut self, parser: ReadStatParser, ) -> Result<ReadStatParser, ReadStatError>
Configures a ReadStatParser to read from this buffer context
instead of from a file.
Auto Trait Implementations§
impl<'a> Freeze for ReadStatBufferCtx<'a>
impl<'a> RefUnwindSafe for ReadStatBufferCtx<'a>
impl<'a> !Send for ReadStatBufferCtx<'a>
impl<'a> !Sync for ReadStatBufferCtx<'a>
impl<'a> Unpin for ReadStatBufferCtx<'a>
impl<'a> UnsafeUnpin for ReadStatBufferCtx<'a>
impl<'a> UnwindSafe for ReadStatBufferCtx<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more