Struct butane::db::ConnectionSpec
source · pub struct ConnectionSpec {
pub backend_name: String,
pub conn_str: String,
}
Expand description
Connection specification. Contains the name of a database backend
and the backend-specific connection string. See connect
to make a Connection from a ConnectionSpec
.
Fields§
§backend_name: String
§conn_str: String
Implementations§
source§impl ConnectionSpec
impl ConnectionSpec
pub fn new( backend_name: impl Into<String>, conn_str: impl Into<String> ) -> ConnectionSpec
sourcepub fn save(&self, path: &Path) -> Result<(), Error>
pub fn save(&self, path: &Path) -> Result<(), Error>
Save the connection spec to the filesystem for later use.
sourcepub fn load(path: impl AsRef<Path>) -> Result<ConnectionSpec, Error>
pub fn load(path: impl AsRef<Path>) -> Result<ConnectionSpec, Error>
Load a previously saved connection spec
pub fn get_backend(&self) -> Result<Box<dyn Backend + 'static, Global>, Error>
Trait Implementations§
source§impl Debug for ConnectionSpec
impl Debug for ConnectionSpec
source§impl<'de> Deserialize<'de> for ConnectionSpec
impl<'de> Deserialize<'de> for ConnectionSpec
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ConnectionSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<ConnectionSpec, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<ConnectionSpec> for ConnectionSpec
impl PartialEq<ConnectionSpec> for ConnectionSpec
source§fn eq(&self, other: &ConnectionSpec) -> bool
fn eq(&self, other: &ConnectionSpec) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ConnectionSpec
impl Serialize for ConnectionSpec
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for ConnectionSpec
impl StructuralEq for ConnectionSpec
impl StructuralPartialEq for ConnectionSpec
Auto Trait Implementations§
impl RefUnwindSafe for ConnectionSpec
impl Send for ConnectionSpec
impl Sync for ConnectionSpec
impl Unpin for ConnectionSpec
impl UnwindSafe for ConnectionSpec
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more