Skip to main content

FileStorage

Struct FileStorage 

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

An app’s storage kept in storage.json of a directory: the app’s data directory (crate::EngineConfig::data_dir), or one the embedding app chooses.

Implementations§

Source§

impl FileStorage

Source

pub fn open(dir: impl Into<PathBuf>) -> Arc<Self> ⓘ

The storage in dir/storage.json: the one already open in this process, or a new one (the directory is made on the first write).

Source

pub fn path(&self) -> &Path

The file it keeps the entries in.

Trait Implementations§

Source§

impl Drop for FileStorage

Source§

fn drop(&mut self)

Waits for the last changes to be written.

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
Source§

impl StorageBackend for FileStorage

Source§

fn write(&self, change: StorageChange) -> Result<(), String>

Hands change to the writer thread: the file is written after this returns, so an error writing it is only logged, and the change stays in memory, written with the next.

Source§

fn load(&self) -> Result<BTreeMap<String, String>, String>

The entries kept, read once when the app first uses its storage; an error leaves the app with none (logged).

Auto Trait Implementations§

§

impl !Freeze for FileStorage

§

impl Forget for FileStorage

§

impl Move for FileStorage

§

impl RefUnwindSafe for FileStorage

§

impl Send for FileStorage

§

impl Sync for FileStorage

§

impl Unpin for FileStorage
where *const u8 is !null: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *mut Counter<Channel<StorageChange>>: Unpin, *mut Counter<Channel<StorageChange>>: Unpin, *mut Counter<Channel<StorageChange>>: Unpin, Arc<Inner, System>: Unpin, Arc<Packet<'static, ()>>: Unpin,

§

impl UnsafeUnpin for FileStorage
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const LeafNode<String, String> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, String)>>: UnsafeUnpin, *mut Counter<Channel<StorageChange>>: UnsafeUnpin, *mut Counter<Channel<StorageChange>>: UnsafeUnpin, *mut Counter<Channel<StorageChange>>: UnsafeUnpin, *const ArcInner<Inner> is !null: UnsafeUnpin, PhantomData<ArcInner<Inner>>: UnsafeUnpin, *const ArcInner<Packet<'static, ()>> is !null: UnsafeUnpin, PhantomData<ArcInner<Packet<'static, ()>>>: UnsafeUnpin,

§

impl UnwindSafe for FileStorage

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ParallelSend for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more