pub trait BackendTrait:
Sized
+ Send
+ Sync
+ 'static {
type ConnectionManager: ManageConnection;
type ConnectionError: Debug;
type QueryError: Debug;
// Required methods
fn init(&self) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
fn create(
&self,
db_id: Uuid,
restrict_privileges: bool,
) -> Result<Pool<Self::ConnectionManager>, Error<Self::ConnectionError, Self::QueryError>>;
fn clean(
&self,
db_id: Uuid,
) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
fn drop(
&self,
db_id: Uuid,
is_restricted: bool,
) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
}Expand description
Backend trait
Required Associated Types§
Sourcetype ConnectionManager: ManageConnection
type ConnectionManager: ManageConnection
Type that implements the r2d2::ManageConnection trait
Sourcetype ConnectionError: Debug
type ConnectionError: Debug
Connection error type that implements Debug
Sourcetype QueryError: Debug
type QueryError: Debug
Query error type that implements Debug
Required Methods§
Sourcefn init(&self) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
fn init(&self) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
Initializes the backend
Sourcefn create(
&self,
db_id: Uuid,
restrict_privileges: bool,
) -> Result<Pool<Self::ConnectionManager>, Error<Self::ConnectionError, Self::QueryError>>
fn create( &self, db_id: Uuid, restrict_privileges: bool, ) -> Result<Pool<Self::ConnectionManager>, Error<Self::ConnectionError, Self::QueryError>>
Creates a database
Sourcefn clean(
&self,
db_id: Uuid,
) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
fn clean( &self, db_id: Uuid, ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
Cleans a database
Sourcefn drop(
&self,
db_id: Uuid,
is_restricted: bool,
) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
fn drop( &self, db_id: Uuid, is_restricted: bool, ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>
Drops a database
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.