Struct ConnectionBuilder

Source
pub struct ConnectionBuilder { /* private fields */ }

Implementations§

Source§

impl ConnectionBuilder

Source

pub fn new() -> Self

Configure and build a new Connection.

Source

pub fn thread_builder(self, thread: Builder) -> Self

Configure the thread that the database connection will live on.

Source

pub fn channel_size(self, size: usize) -> Self

Configure how many functions can be queued to run on our connection before conn.call(..).await will wait and backpressure will kick in.

Source

pub fn on_close<F: FnOnce(Option<Connection>) + Send + 'static>( self, f: F, ) -> Self

Configure a function to be called exactly once when the connection is closed. If the database has already been closed then it will be given None, else it will be handed the database connection.

Source

pub async fn open<P: AsRef<Path>>(self, path: P) -> Result<Connection, Error>

Open a new connection to an SQLite database. If a database does not exist at the path, one is created.

§Failure

Will return Err if path cannot be converted to a C-compatible string or if the underlying SQLite open call fails.

Source

pub async fn open_in_memory(self) -> Result<Connection, Error>

Open a new connection to an in-memory SQLite database.

§Failure

Will return Err if the underlying SQLite open call fails.

Source

pub async fn open_with_flags<P: AsRef<Path>>( self, path: P, flags: OpenFlags, ) -> Result<Connection, Error>

Open a new connection to a SQLite database.

Database Connection for a description of valid flag combinations.

§Failure

Will return Err if path cannot be converted to a C-compatible string or if the underlying SQLite open call fails.

Source

pub async fn open_with_flags_and_vfs<P: AsRef<Path>>( self, path: P, flags: OpenFlags, vfs: &str, ) -> Result<Connection, Error>

Open a new connection to a SQLite database using the specific flags and vfs name.

Database Connection for a description of valid flag combinations.

§Failure

Will return Err if either path or vfs cannot be converted to a C-compatible string or if the underlying SQLite open call fails.

Source

pub async fn open_in_memory_with_flags( self, flags: OpenFlags, ) -> Result<Connection, Error>

Open a new connection to an in-memory SQLite database.

Database Connection for a description of valid flag combinations.

§Failure

Will return Err if the underlying SQLite open call fails.

Source

pub async fn open_in_memory_with_flags_and_vfs( self, flags: OpenFlags, vfs: &str, ) -> Result<Connection, Error>

Open a new connection to an in-memory SQLite database using the specific flags and vfs name.

Database Connection for a description of valid flag combinations.

§Failure

Will return Err if vfs cannot be converted to a C-compatible string or if the underlying SQLite open call fails.

Trait Implementations§

Source§

impl Default for ConnectionBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.