Trait Vfs

Source
pub trait Vfs: Sync {
    type Handle: DatabaseHandle;

    // Required methods
    fn open(&self, db: &str, opts: OpenOptions) -> Result<Self::Handle, Error>;
    fn delete(&self, db: &str) -> Result<(), Error>;
    fn exists(&self, db: &str) -> Result<bool, Error>;
    fn temporary_name(&self) -> String;
    fn random(&self, buffer: &mut [i8]);
    fn sleep(&self, duration: Duration) -> Duration;

    // Provided methods
    fn access(&self, _db: &str, _write: bool) -> Result<bool, Error> { ... }
    fn full_pathname<'a>(&self, db: &'a str) -> Result<Cow<'a, str>, Error> { ... }
}
Expand description

A virtual file system for SQLite.

Required Associated Types§

Source

type Handle: DatabaseHandle

The file returned by Vfs::open.

Required Methods§

Source

fn open(&self, db: &str, opts: OpenOptions) -> Result<Self::Handle, Error>

Open the database db (of type opts.kind).

Source

fn delete(&self, db: &str) -> Result<(), Error>

Delete the database db.

Source

fn exists(&self, db: &str) -> Result<bool, Error>

Check if a database db already exists.

Source

fn temporary_name(&self) -> String

Generate and return a path for a temporary database.

Source

fn random(&self, buffer: &mut [i8])

Populate the buffer with random data.

Source

fn sleep(&self, duration: Duration) -> Duration

Sleep for duration. Return the duration actually slept.

Provided Methods§

Source

fn access(&self, _db: &str, _write: bool) -> Result<bool, Error>

Check access to db. The default implementation always returns true.

Source

fn full_pathname<'a>(&self, db: &'a str) -> Result<Cow<'a, str>, Error>

Retrieve the full pathname of a database db.

Implementors§