Skip to main content

InMemoryEditor

Struct InMemoryEditor 

Source
pub struct InMemoryEditor { /* private fields */ }
Expand description

Mutable v1 file facade implemented by loading frames and rewriting the file on save.

FWOB v1 stores frames as a flat sorted array. Deletes require compaction in the original C# implementation; this editor performs the same logical operation by rewriting the file. That is acceptable for compatibility and for the rare bulk-deletion workflow that v2 is designed around.

Implementations§

Source§

impl InMemoryEditor

Source

pub fn open(path: impl AsRef<Path>, key_field_index: usize) -> Result<Self>

Source

pub fn new(schema: Schema, title: impl Into<String>) -> Result<Self>

Source

pub fn schema(&self) -> &Schema

Source

pub fn title(&self) -> &str

Source

pub fn frame_count(&self) -> u64

Source

pub fn string_table(&self) -> &[String]

Source

pub fn frames(&self) -> &[OwnedFrame]

Source

pub fn append_string(&mut self, value: impl Into<String>) -> u32

Source

pub fn append_frame(&mut self, bytes: &[u8]) -> Result<()>

Source

pub fn append_frames<I, B>(&mut self, frames: I) -> Result<()>
where I: IntoIterator<Item = B>, B: AsRef<[u8]>,

Source

pub fn delete_all_frames(&mut self) -> u64

Source

pub fn delete_frames_before(&mut self, last_key: Key) -> Result<u64>

Source

pub fn delete_frames_after(&mut self, first_key: Key) -> Result<u64>

Source

pub fn delete_frames_between( &mut self, first_key: Key, last_key: Key, ) -> Result<u64>

Source

pub fn delete_frames<I>(&mut self, keys: I) -> Result<u64>
where I: IntoIterator<Item = Key>,

Source

pub fn save_as(&self, path: impl AsRef<Path>) -> Result<()>

Auto Trait Implementations§

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.