pub trait CreatableModel:
BaseModel
+ Send
+ Sync
+ 'static {
type CreateOptions<'a>: Send + Sync + Validate;
type CreateResult: Send;
// Required methods
fn get_create_handlers() -> &'static LazyLock<CreateListenerList<Self>>;
fn create<'life0, 'life1, 'async_trait>(
state: &'life0 State,
options: Self::CreateOptions<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Self::CreateResult, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn register_create_handler<'async_trait, F>(
priority: ListenerPriority,
callback: F,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static,
Self: 'async_trait { ... }
fn blocking_register_create_handler<F: for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>(
priority: ListenerPriority,
callback: F,
) { ... }
fn run_create_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
options: &'life0 mut Self::CreateOptions<'life1>,
query_builder: &'life2 mut InsertQueryBuilder<'_>,
state: &'life3 State,
transaction: &'life4 mut Transaction<'life5, Postgres>,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait { ... }
}Required Associated Types§
type CreateOptions<'a>: Send + Sync + Validate
type CreateResult: Send
Required Methods§
fn get_create_handlers() -> &'static LazyLock<CreateListenerList<Self>>
fn create<'life0, 'life1, 'async_trait>(
state: &'life0 State,
options: Self::CreateOptions<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Self::CreateResult, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn register_create_handler<'async_trait, F>(
priority: ListenerPriority,
callback: F,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
F: 'async_trait + for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static,
Self: 'async_trait,
Sourcefn blocking_register_create_handler<F: for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>(
priority: ListenerPriority,
callback: F,
)
fn blocking_register_create_handler<F: for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>( priority: ListenerPriority, callback: F, )
§Warning
This method will block the current thread if the lock is not available
fn run_create_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
options: &'life0 mut Self::CreateOptions<'life1>,
query_builder: &'life2 mut InsertQueryBuilder<'_>,
state: &'life3 State,
transaction: &'life4 mut Transaction<'life5, Postgres>,
) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.