pub trait DuplicableModel:
BaseModel
+ Send
+ Sync
+ 'static {
type DuplicateOptions<'a>: Send + Sync + Validate;
// Required methods
fn get_duplicate_handlers() -> &'static LazyLock<DuplicateHandlerList<Self>>;
fn duplicate_with_transaction<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 State,
options: Self::DuplicateOptions<'life2>,
transaction: &'life3 mut Transaction<'life4, Postgres>,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
// Provided methods
fn register_duplicate_handler<'async_trait, F>(
priority: ListenerPriority,
callback: F,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a Self, &'a Self::DuplicateOptions<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static,
Self: 'async_trait { ... }
fn register_after_duplicate_handler<'async_trait, F>(
priority: ListenerPriority,
callback: F,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a Self, &'a mut Self, &'a Self::DuplicateOptions<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static,
Self: 'async_trait { ... }
fn blocking_register_duplicate_handler<F: for<'a> Fn(&'a Self, &'a Self::DuplicateOptions<'_>, &'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_after_duplicate_handler<F: for<'a> Fn(&'a Self, &'a mut Self, &'a Self::DuplicateOptions<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>(
priority: ListenerPriority,
callback: F,
) { ... }
fn run_duplicate_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
options: &'life1 Self::DuplicateOptions<'life2>,
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 { ... }
fn run_after_duplicate_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
duplicated: &'life1 mut Self,
options: &'life2 Self::DuplicateOptions<'life3>,
state: &'life4 State,
transaction: &'life5 mut Transaction<'life6, 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,
'life6: 'async_trait { ... }
fn duplicate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 State,
options: Self::DuplicateOptions<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Required Associated Types§
type DuplicateOptions<'a>: Send + Sync + Validate
Required Methods§
fn get_duplicate_handlers() -> &'static LazyLock<DuplicateHandlerList<Self>>
fn duplicate_with_transaction<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 State,
options: Self::DuplicateOptions<'life2>,
transaction: &'life3 mut Transaction<'life4, Postgres>,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Provided Methods§
fn register_duplicate_handler<'async_trait, F>( priority: ListenerPriority, callback: F, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn register_after_duplicate_handler<'async_trait, F>( priority: ListenerPriority, callback: F, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Sourcefn blocking_register_duplicate_handler<F: for<'a> Fn(&'a Self, &'a Self::DuplicateOptions<'_>, &'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_duplicate_handler<F: for<'a> Fn(&'a Self, &'a Self::DuplicateOptions<'_>, &'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
Sourcefn blocking_register_after_duplicate_handler<F: for<'a> Fn(&'a Self, &'a mut Self, &'a Self::DuplicateOptions<'_>, &'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_after_duplicate_handler<F: for<'a> Fn(&'a Self, &'a mut Self, &'a Self::DuplicateOptions<'_>, &'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_duplicate_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
options: &'life1 Self::DuplicateOptions<'life2>,
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,
fn run_after_duplicate_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
duplicated: &'life1 mut Self,
options: &'life2 Self::DuplicateOptions<'life3>,
state: &'life4 State,
transaction: &'life5 mut Transaction<'life6, 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,
'life6: 'async_trait,
fn duplicate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 State,
options: Self::DuplicateOptions<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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.