Skip to main content

Buffer

Struct Buffer 

Source
pub struct Buffer<const N: usize> { /* private fields */ }
Available on non-crate feature lock only.
Expand description

A null terminated buffer of N bytes, on the stack while what it holds fits.

Both directions go through it: an argument is copied in and handed to CSPICE as a pointer, and an output is zeroed, written by CSPICE, then read back.

Implementations§

Source§

impl<const N: usize> Buffer<N>

Source

pub fn from_text(value: &str) -> Self

A null terminated copy of value.

§Panics

Panics if value contains an interior null byte: C has no way to represent it, so passing one along would silently truncate the argument.

Source

pub fn with_len(len: usize) -> Self

A zeroed buffer of len bytes, for CSPICE to write a string into.

Source

pub fn as_mut_ptr(&mut self) -> *mut SpiceChar

The pointer to hand to CSPICE.

Source

pub fn into_string(self) -> String

Read the buffer back as a Rust string.

Auto Trait Implementations§

§

impl<const N: usize> Freeze for Buffer<N>
where [i8; N]: Freeze,

§

impl<const N: usize> RefUnwindSafe for Buffer<N>
where [i8; N]: RefUnwindSafe,

§

impl<const N: usize> Send for Buffer<N>
where [i8; N]: Send,

§

impl<const N: usize> Sync for Buffer<N>
where [i8; N]: Sync,

§

impl<const N: usize> Unpin for Buffer<N>
where [i8; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for Buffer<N>
where [i8; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for Buffer<N>
where [i8; N]: UnwindSafe,

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.