Skip to main content

Options

Struct Options 

Source
pub struct Options<'a, P: Policy> {
    pub settings: SqliteSettings,
    pub readers: NonZeroUsize,
    pub prepare_on_reader: bool,
    pub whole_views: Arc<WholeViews>,
    pub policy: &'a dyn Fn() -> P,
    pub setup: &'a dyn Fn(&Setup<'_, P>, &P) -> Result<()>,
    pub capture: Option<BTreeSet<String>>,
    pub checkpoint_pages: Option<NonZeroU32>,
    pub statistics: bool,
}
Expand description

How to open a database’s connections. Every connection gets a policy of its own from policy, and the same setup.

Fields§

§settings: SqliteSettings

The SQLite settings of every connection.

§readers: NonZeroUsize

The read-only connections beside the writer.

§prepare_on_reader: bool

Run prepare on the first reader, and open the writer only once prepare passes, leaving the journal mode as it is. Set this for a database whose checks must not write, because its writer would create the file or the schema the checks look for. Otherwise the writer switches the database to WAL and runs prepare.

§whole_views: Arc<WholeViews>

The views and tables a live query reads whole.

§policy: &'a dyn Fn() -> P

Each connection’s policy, made as the connection opens.

§setup: &'a dyn Fn(&Setup<'_, P>, &P) -> Result<()>

What each connection registers, given that connection’s policy, before any SQL runs on it.

§capture: Option<BTreeSet<String>>

Capture the writer’s commits for the handle’s live queries, and record each operation of a write on these tables, named in lowercase, with every column’s value before and after it.

§checkpoint_pages: Option<NonZeroU32>

Checkpoint the WAL on a thread of its own once it holds this many frames not yet in the database file (§4).

§statistics: bool

Gather the planner’s statistics as the database opens, keep them on a thread of their own while it stays open, and gather them again as it closes (§4).

Auto Trait Implementations§

§

impl<'a, P> !RefUnwindSafe for Options<'a, P>

§

impl<'a, P> !Send for Options<'a, P>

§

impl<'a, P> !Sync for Options<'a, P>

§

impl<'a, P> !UnwindSafe for Options<'a, P>

§

impl<'a, P> Freeze for Options<'a, P>

§

impl<'a, P> Unpin for Options<'a, P>

§

impl<'a, P> UnsafeUnpin for Options<'a, P>

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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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