Skip to main content

FileRecorder

Struct FileRecorder 

Source
pub struct FileRecorder<'a> {
    pub last_rn: u32,
    /* private fields */
}
Expand description

recorder for one file

Fields§

§last_rn: u32

number of the last record written (relative to the first_rec_num)

Implementations§

Source§

impl<'a> FileRecorder<'_>

Source

pub fn new( path: &Path, first_rec_num: u64, max_num_segments: u32, max_nrps: u32, ) -> Result<Self>

Create a new file recorder

§Arguments
  • path - The path of the file to be recorded.
  • first_rec_num - The first record number. Al the record numbers in the file are relative to this one
  • max_num_seg - The maximum number of segments that can be stored in the file. This determines the size of the header
  • max_nrps - The maximum number of records per segment
Source

pub fn append(&mut self, rn: u64, msg: &[u8], is_pdef: bool) -> Result<()>

append the record to the end of the file

Source

pub fn is_full(&self) -> bool

Source

pub fn flush(&mut self) -> Result<()>

Trait Implementations§

Source§

impl<'a> Drop for FileRecorder<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for FileRecorder<'a>

§

impl<'a> Freeze for FileRecorder<'a>

§

impl<'a> RefUnwindSafe for FileRecorder<'a>

§

impl<'a> Send for FileRecorder<'a>

§

impl<'a> Sync for FileRecorder<'a>

§

impl<'a> Unpin for FileRecorder<'a>

§

impl<'a> UnsafeUnpin for FileRecorder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.