pub struct DatabaseUserApp;Available on crate feature
db only.Expand description
An app that provides authentication via a user model stored in the database.
Implementations§
Source§impl DatabaseUserApp
impl DatabaseUserApp
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of the database user authentication app.
§Example
use cot::auth::db::DatabaseUserApp;
use cot::config::{DatabaseConfig, ProjectConfig};
use cot::project::RegisterAppsContext;
use cot::{App, AppBuilder, Project};
struct HelloProject;
impl Project for HelloProject {
fn config(&self, config_name: &str) -> cot::Result<ProjectConfig> {
Ok(ProjectConfig::builder()
.database(DatabaseConfig::builder().url("sqlite::memory:").build())
.build())
}
fn register_apps(&self, apps: &mut AppBuilder, _context: &RegisterAppsContext) {
use cot::project::{RegisterAppsContext, WithConfig};
apps.register_with_views(DatabaseUserApp::new(), "");
}
}
#[cot::main]
fn main() -> impl Project {
HelloProject
}Trait Implementations§
Source§impl App for DatabaseUserApp
impl App for DatabaseUserApp
Source§fn admin_model_managers(&self) -> Vec<Box<dyn AdminModelManager>>
fn admin_model_managers(&self) -> Vec<Box<dyn AdminModelManager>>
Returns the admin model managers for the app. By default, it returns an
empty list.
Source§fn migrations(&self) -> Vec<Box<SyncDynMigration>>
fn migrations(&self) -> Vec<Box<SyncDynMigration>>
Returns the migrations for the app. By default, it returns an empty
list.
Source§fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut ProjectContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut ProjectContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initializes the app. Read more
Source§fn router(&self) -> Router
fn router(&self) -> Router
Returns the router for the app. By default, it returns an empty router. Read more
Source§fn static_files(&self) -> Vec<StaticFile>
fn static_files(&self) -> Vec<StaticFile>
Returns a list of static files that the app serves. By default, it
returns an empty list.
Source§impl Clone for DatabaseUserApp
impl Clone for DatabaseUserApp
Source§fn clone(&self) -> DatabaseUserApp
fn clone(&self) -> DatabaseUserApp
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatabaseUserApp
impl Debug for DatabaseUserApp
Source§impl Default for DatabaseUserApp
impl Default for DatabaseUserApp
impl Copy for DatabaseUserApp
Auto Trait Implementations§
impl Freeze for DatabaseUserApp
impl RefUnwindSafe for DatabaseUserApp
impl Send for DatabaseUserApp
impl Sync for DatabaseUserApp
impl Unpin for DatabaseUserApp
impl UnwindSafe for DatabaseUserApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoField<Auto<T>> for T
impl<T> IntoField<Auto<T>> for T
Source§fn into_field(self) -> Auto<T>
fn into_field(self) -> Auto<T>
Available on crate feature
db only.Converts the type to the field type.