pub struct ConnectionString(/* private fields */);Expand description
A connection string for a postgres database. See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS
Implementations§
Source§impl ConnectionString
impl ConnectionString
Sourcepub fn new(con_string: &str) -> Result<Self>
pub fn new(con_string: &str) -> Result<Self>
Create a new connection string from a string. This function validates that the connection string is a postgres connection string.
Sourcepub fn database_name(&self) -> &str
pub fn database_name(&self) -> &str
Get the database name For postgres, this is the database name directly For sqlite, this is the path to the database file
Sourcepub fn set_database_name(&mut self, db_name: &str)
pub fn set_database_name(&mut self, db_name: &str)
Set the database name
Trait Implementations§
Source§impl Clone for ConnectionString
impl Clone for ConnectionString
Source§fn clone(&self) -> ConnectionString
fn clone(&self) -> ConnectionString
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 ConnectionString
impl Debug for ConnectionString
Source§impl Default for ConnectionString
impl Default for ConnectionString
Source§impl<'de> Deserialize<'de> for ConnectionString
impl<'de> Deserialize<'de> for ConnectionString
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ConnectionString
impl Display for ConnectionString
Source§impl From<Url> for ConnectionString
impl From<Url> for ConnectionString
Source§impl FromStr for ConnectionString
impl FromStr for ConnectionString
Source§impl PartialEq for ConnectionString
impl PartialEq for ConnectionString
Source§impl Serialize for ConnectionString
impl Serialize for ConnectionString
impl StructuralPartialEq for ConnectionString
Auto Trait Implementations§
impl Freeze for ConnectionString
impl RefUnwindSafe for ConnectionString
impl Send for ConnectionString
impl Sync for ConnectionString
impl Unpin for ConnectionString
impl UnsafeUnpin for ConnectionString
impl UnwindSafe for ConnectionString
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.