Struct SqlIdentityBuilder

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

Implementations§

Source§

impl SqlIdentityBuilder

Source

pub fn new<T: Into<String>>(uri: T) -> SqlIdentityBuilder

Creates a new SqlIdentityBuilder that constructs a SqlIdentityPolicy

§Arguments
  • uri - Database connection string
§Example

use actix_web::App;
use actix_web::middleware::identity::IdentityService;
use actix_web_sql_identity::SqlIdentityBuilder;

// Create the identity policy
let policy = SqlIdentityBuilder::new("postgres://user:pass@host/database")
                .pool_size(5)
                .response_header("X-MY-RESPONSE")
                .finish()
                .expect("failed to open database");

let app = App::new().middleware(IdentityService::new(
    policy
));
Source

pub fn response_header(self, hdr: &'static str) -> SqlIdentityBuilder

Change the response header when an identity is remembered

§Arguments
  • hdr - Response header name to use
Source

pub fn pool_size(self, count: usize) -> SqlIdentityBuilder

Change how many SQL connections are in each pool

§Arguments
  • count - Number of connections per pool
Source

pub fn finish(self) -> Result<SqlIdentityPolicy, Error>

Finish building this SQL identity policy. This will attempt to construct the a pool of connections to the database specified. The type of database is determined by the uri set. On success, a new SqlIdentityPolicy is returned, on failure an error is returned.

Source

pub fn sqlite(self) -> SqlIdentityBuilder

Forces a SQLite identity policy to be created. This function does not normally need to be used, new will automatically determine the appropriate variant by parsing the connection string. This function exists if the parsing fails

Source

pub fn mysql(self) -> SqlIdentityBuilder

Forces a MySQL identity policy to be created. This function does not normally need to be used, new will automatically determine the appropriate variant by parsing the connection string. This function exists if the parsing fails

Source

pub fn postgresql(self) -> SqlIdentityBuilder

Forces a PostgreSQL identity policy to be created. This function does not normally need to be used, new will automatically determine the appropriate variant by parsing the connection string. This function exists if the parsing fails

Trait Implementations§

Source§

impl Clone for SqlIdentityBuilder

Source§

fn clone(&self) -> SqlIdentityBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>,

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Erased for T