[][src]Struct r2d2_sqlite::SqliteConnectionManager

pub struct SqliteConnectionManager { /* fields omitted */ }

An r2d2::ManageConnection for rusqlite::Connections.

Implementations

impl SqliteConnectionManager[src]

pub fn file<P: AsRef<Path>>(path: P) -> Self[src]

Creates a new SqliteConnectionManager from file.

See rusqlite::Connection::open

pub fn memory() -> Self[src]

Creates a new SqliteConnectionManager from memory.

pub fn with_flags(self, flags: OpenFlags) -> Self[src]

Converts SqliteConnectionManager into one that sets OpenFlags upon connection creation.

See rustqlite::OpenFlags for a list of available flags.

pub fn with_init<F>(self, init: F) -> Self where
    F: Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static, 
[src]

Converts SqliteConnectionManager into one that calls an initialization function upon connection creation. Could be used to set PRAGMAs, for example.

Example

Make a SqliteConnectionManager that sets the foreign_keys pragma to true for every connection.

let manager = SqliteConnectionManager::file("app.db")
    .with_init(|c| c.execute_batch("PRAGMA foreign_keys=1;"));

Trait Implementations

impl Debug for SqliteConnectionManager[src]

impl ManageConnection for SqliteConnectionManager[src]

type Connection = Connection

The connection type this manager deals with.

type Error = Error

The error type returned by Connections.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.