pub struct TieredStorageFile(pub File);
Tuple Fields§
§0: File
Implementations§
source§impl TieredStorageFile
impl TieredStorageFile
pub fn new_readonly(file_path: impl AsRef<Path>) -> Self
pub fn new_writable(file_path: impl AsRef<Path>) -> IoResult<Self>
sourcepub fn write_pod<T: NoUninit>(&self, value: &T) -> IoResult<usize>
pub fn write_pod<T: NoUninit>(&self, value: &T) -> IoResult<usize>
Writes value
to the file.
value
must be plain ol’ data.
sourcepub unsafe fn write_type<T>(&self, value: &T) -> IoResult<usize>
pub unsafe fn write_type<T>(&self, value: &T) -> IoResult<usize>
Writes value
to the file.
Prefer write_pod
when possible, because write_value
may cause
undefined behavior if value
contains uninitialized bytes.
§Safety
Caller must ensure casting T to bytes is safe. Refer to the Safety sections in std::slice::from_raw_parts() and bytemuck’s Pod and NoUninit for more information.
sourcepub fn read_pod<T: NoUninit + AnyBitPattern>(
&self,
value: &mut T,
) -> IoResult<()>
pub fn read_pod<T: NoUninit + AnyBitPattern>( &self, value: &mut T, ) -> IoResult<()>
Reads a value of type T
from the file.
Type T must be plain ol’ data.
sourcepub unsafe fn read_type<T>(&self, value: &mut T) -> IoResult<()>
pub unsafe fn read_type<T>(&self, value: &mut T) -> IoResult<()>
Reads a value of type T
from the file.
Prefer read_pod()
when possible, because read_type()
may cause
undefined behavior.
§Safety
Caller must ensure casting bytes to T is safe. Refer to the Safety sections in std::slice::from_raw_parts() and bytemuck’s Pod and AnyBitPattern for more information.
pub fn seek(&self, offset: u64) -> IoResult<u64>
pub fn seek_from_end(&self, offset: i64) -> IoResult<u64>
pub fn write_bytes(&self, bytes: &[u8]) -> IoResult<usize>
pub fn read_bytes(&self, buffer: &mut [u8]) -> IoResult<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TieredStorageFile
impl RefUnwindSafe for TieredStorageFile
impl Send for TieredStorageFile
impl Sync for TieredStorageFile
impl Unpin for TieredStorageFile
impl UnwindSafe for TieredStorageFile
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more