pub struct SecBytes { /* private fields */ }Expand description
Secure byte buffer with automatic expansion
Implementations§
Source§impl SecBytes
impl SecBytes
Sourcepub fn with_capacity(cap: usize) -> Result<Self, Error>
pub fn with_capacity(cap: usize) -> Result<Self, Error>
Creates new buffer with specified initial capacity
Sourcepub fn append(&mut self, input: impl AsMut<[u8]>) -> Result<(), Error>
pub fn append(&mut self, input: impl AsMut<[u8]>) -> Result<(), Error>
Appends data to the buffer, securely erasing the source. Takes ownership of the input slice by zeroing it.
Sourcepub fn new(input: impl AsMut<[u8]>) -> Result<Self, Error>
pub fn new(input: impl AsMut<[u8]>) -> Result<Self, Error>
Creates new buffer initialized with provided data
Sourcepub fn read(&self) -> Result<SecReadBytes<'_>, Error>
pub fn read(&self) -> Result<SecReadBytes<'_>, Error>
Returns slice view of the contained data
Sourcepub fn write(&mut self) -> Result<SecWriteBytes<'_>, Error>
pub fn write(&mut self) -> Result<SecWriteBytes<'_>, Error>
Returns mutable slice view of the contained data
Auto Trait Implementations§
impl !Freeze for SecBytes
impl RefUnwindSafe for SecBytes
impl !Send for SecBytes
impl !Sync for SecBytes
impl Unpin for SecBytes
impl UnwindSafe for SecBytes
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