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>
impl<const N: usize> Buffer<N>
Sourcepub fn from_text(value: &str) -> Self
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.
Sourcepub fn with_len(len: usize) -> Self
pub fn with_len(len: usize) -> Self
A zeroed buffer of len bytes, for CSPICE to write a string into.
Sourcepub fn as_mut_ptr(&mut self) -> *mut SpiceChar
pub fn as_mut_ptr(&mut self) -> *mut SpiceChar
The pointer to hand to CSPICE.
Sourcepub fn into_string(self) -> String
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>
impl<const N: usize> RefUnwindSafe for Buffer<N>
impl<const N: usize> Send for Buffer<N>
impl<const N: usize> Sync for Buffer<N>
impl<const N: usize> Unpin for Buffer<N>
impl<const N: usize> UnsafeUnpin for Buffer<N>
impl<const N: usize> UnwindSafe for Buffer<N>
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