pub struct BoxFileWriter { /* private fields */ }
Implementations§
Source§impl BoxFileWriter
impl BoxFileWriter
pub fn finish(self) -> Result<u64>
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<BoxFileWriter>
pub fn open<P: AsRef<Path>>(path: P) -> Result<BoxFileWriter>
This will open an existing .box
file for writing, and error if the file is not valid.
Sourcepub fn create<P: AsRef<Path>>(path: P) -> Result<BoxFileWriter>
pub fn create<P: AsRef<Path>>(path: P) -> Result<BoxFileWriter>
This will create a new .box
file for writing, and error if the file already exists.
Sourcepub fn create_with_alignment<P: AsRef<Path>>(
path: P,
alignment: u64,
) -> Result<BoxFileWriter>
pub fn create_with_alignment<P: AsRef<Path>>( path: P, alignment: u64, ) -> Result<BoxFileWriter>
This will create a new .box
file for reading and writing, and error if the file already exists.
Will insert byte-aligned values based on provided alignment
value. For best results, consider a power of 2.
pub fn path(&self) -> &Path
pub fn alignment(&self) -> u64
pub fn version(&self) -> u32
Sourcepub fn metadata(&self) -> &BoxMetadata
pub fn metadata(&self) -> &BoxMetadata
Will return the metadata for the .box
if it has been provided.
pub fn mkdir( &mut self, path: BoxPath, attrs: HashMap<String, Vec<u8>>, ) -> Result<()>
pub fn link( &mut self, path: BoxPath, target: BoxPath, attrs: HashMap<String, Vec<u8>>, ) -> Result<()>
pub fn insert<R: Read>( &mut self, compression: Compression, path: BoxPath, value: &mut R, attrs: HashMap<String, Vec<u8>>, ) -> Result<&FileRecord>
Sourcepub unsafe fn data(&self, record: &FileRecord) -> Result<Mmap>
pub unsafe fn data(&self, record: &FileRecord) -> Result<Mmap>
§Safety
Use of memory maps is unsafe as modifications to the file could affect the operation of the application. Ensure that the Box being operated on is not mutated while a memory map is in use.
pub fn set_attr<S: AsRef<str>>( &mut self, path: &BoxPath, key: S, value: Vec<u8>, ) -> Result<()>
pub fn set_file_attr<S: AsRef<str>>( &mut self, key: S, value: Vec<u8>, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoxFileWriter
impl RefUnwindSafe for BoxFileWriter
impl Send for BoxFileWriter
impl Sync for BoxFileWriter
impl Unpin for BoxFileWriter
impl UnwindSafe for BoxFileWriter
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