pub struct SecBytes { /* private fields */ }Expand description
Secure byte container with access-control semantics
This structure provides:
- Reader counting for concurrent access
- Secure wipe on deallocation
- Guard-based access control
Implementations§
Source§impl SecBytes
impl SecBytes
Sourcepub fn with_capacity(cap: usize) -> Result<Self, Error>
pub fn with_capacity(cap: usize) -> Result<Self, Error>
Create byte container with pre-allocated capacity
Sourcepub fn from_bytes(input: impl AsMut<[u8]>) -> Result<Self, Error>
pub fn from_bytes(input: impl AsMut<[u8]>) -> Result<Self, Error>
Create from existing byte slice
Securely copies data into new protected memory region
Sourcepub fn view(&self) -> Result<SecReadBytes<'_>, Error>
pub fn view(&self) -> Result<SecReadBytes<'_>, Error>
Create a read guard for immutable access
Enables read-only access and tracks concurrent readers
Sourcepub fn edit(&mut self) -> Result<SecWriteBytes<'_>, Error>
pub fn edit(&mut self) -> Result<SecWriteBytes<'_>, Error>
Create a write guard for mutable access
Enables exclusive write access (blocks concurrent readers)
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