pub struct LargeBuffer { /* private fields */ }Expand description
A large buffer backed by a temporary file.
This buffer uses a file to store data, with optional memory mapping for efficient access to large datasets.
Implementations§
Source§impl LargeBuffer
impl LargeBuffer
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new large buffer with a temporary file.
§Errors
Returns an error if the temporary file cannot be created.
Sourcepub fn with_path(path: &Path) -> Result<Self>
pub fn with_path(path: &Path) -> Result<Self>
Create a new large buffer at the specified path.
§Errors
Returns an error if the file cannot be created.
Sourcepub const fn set_cleanup(&mut self, cleanup: bool)
pub const fn set_cleanup(&mut self, cleanup: bool)
Set whether to delete the file on drop.
Sourcepub fn find(&mut self, needle: &[u8]) -> Result<Option<usize>>
pub fn find(&mut self, needle: &[u8]) -> Result<Option<usize>>
Find a byte sequence in the buffer.
This performs a linear search through the file.
§Errors
Returns an error if reading fails.
Sourcepub fn as_str_lossy(&mut self) -> Result<String>
pub fn as_str_lossy(&mut self) -> Result<String>
Trait Implementations§
Source§impl Debug for LargeBuffer
impl Debug for LargeBuffer
Auto Trait Implementations§
impl Freeze for LargeBuffer
impl RefUnwindSafe for LargeBuffer
impl Send for LargeBuffer
impl Sync for LargeBuffer
impl Unpin for LargeBuffer
impl UnwindSafe for LargeBuffer
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