Skip to main content

CallerOutputSlice

Struct CallerOutputSlice 

Source
pub struct CallerOutputSlice<'a> { /* private fields */ }
Expand description

Caller-supplied mutable output buffer with pre-dispatch capacity checks and explicit written count.

Implementations§

Source§

impl<'a> CallerOutputSlice<'a>

Source

pub fn new(bytes: &'a mut [u8], kind: PrimitiveKind) -> Result<Self, VibeTrap>

Wraps a caller-owned mutable byte buffer for elements of kind.

Source

pub const fn kind(&self) -> PrimitiveKind

Expected element kind.

Source

pub const fn primitive(&self) -> PrimitiveKind

Alias for kind().

Source

pub const fn capacity_elems(&self) -> usize

Total capacity in elements.

Source

pub const fn capacity_bytes(&self) -> usize

Total capacity in bytes.

Source

pub const fn written_elems(&self) -> usize

Number of elements written so far.

Source

pub const fn written_bytes(&self) -> usize

Number of bytes written so far.

Source

pub const fn ensure_elem_capacity( &self, required_elems: usize, ) -> Result<(), VibeTrap>

Verifies that the output buffer can hold at least required_elems before execution begins.

Source

pub fn push_f64_le(&mut self, value: f64) -> Result<(), VibeTrap>

Appends one f64 (little-endian) into the output buffer.

Source

pub fn push_f32_le(&mut self, value: f32) -> Result<(), VibeTrap>

Appends one f32 (little-endian) into the output buffer.

Source

pub fn push_u64_le(&mut self, value: u64) -> Result<(), VibeTrap>

Appends one u64 (little-endian) into the output buffer.

Source

pub fn push_i64_le(&mut self, value: i64) -> Result<(), VibeTrap>

Appends one i64 (little-endian) into the output buffer.

Source

pub fn push_u32_le(&mut self, value: u32) -> Result<(), VibeTrap>

Appends one u32 (little-endian) into the output buffer.

Source

pub fn push_i32_le(&mut self, value: i32) -> Result<(), VibeTrap>

Appends one i32 (little-endian) into the output buffer.

Source

pub fn push_u8(&mut self, value: u8) -> Result<(), VibeTrap>

Appends one u8 into the output buffer.

Source

pub fn push_bool(&mut self, value: bool) -> Result<(), VibeTrap>

Appends one bool into the output buffer.

Source

pub fn write_all( &mut self, raw_bytes: &[u8], elem_count: usize, ) -> Result<(), VibeTrap>

Writes elem_count elements directly from raw_bytes into the output buffer.

Source

pub fn push_nquin(&mut self, quin: &NQuin48) -> Result<(), VibeTrap>

Appends one parity-verified NQuin48 into the output buffer.

Source

pub fn push_resource_handle( &mut self, handle: &ResourceHandle, ) -> Result<(), VibeTrap>

Appends one ResourceHandle (little-endian 24-byte #[repr(C)] layout) into the output buffer.

Source

pub fn push_utf8_bytes(&mut self, bytes: &[u8]) -> Result<(), VibeTrap>

Appends UTF-8 bytes into a PrimitiveKind::Utf8Bytes output buffer after validating UTF-8.

Source

pub fn push_utf8_str(&mut self, s: &str) -> Result<(), VibeTrap>

Appends a UTF-8 string slice into a PrimitiveKind::Utf8Bytes output buffer.

Source

pub fn written_byte_slice(&self) -> &[u8]

Returns the written prefix of the output buffer as an immutable byte slice.

Source§

impl<'a> CallerOutputSlice<'a>

Source

pub fn push_f64_slice(&mut self, values: &[f64]) -> Result<(), VibeTrap>

Atomically appends a slice of f64 values (little-endian) into the output buffer.

Source

pub fn push_f32_slice(&mut self, values: &[f32]) -> Result<(), VibeTrap>

Atomically appends a slice of f32 values (little-endian) into the output buffer.

Source

pub fn write_f64_slice(&mut self, values: &[f64]) -> Result<(), VibeTrap>

Source

pub fn write_f32_slice(&mut self, values: &[f32]) -> Result<(), VibeTrap>

Trait Implementations§

Source§

impl<'a> Debug for CallerOutputSlice<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for CallerOutputSlice<'a>

§

impl<'a> Freeze for CallerOutputSlice<'a>

§

impl<'a> RefUnwindSafe for CallerOutputSlice<'a>

§

impl<'a> Send for CallerOutputSlice<'a>

§

impl<'a> Sync for CallerOutputSlice<'a>

§

impl<'a> Unpin for CallerOutputSlice<'a>

§

impl<'a> UnsafeUnpin for CallerOutputSlice<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.