[−][src]Struct oapth::Config
Configuration to connect to a database
Implementations
impl Config
[src]
pub fn with_url<I>(url: I) -> Self where
I: Into<String>,
[src]
I: Into<String>,
Creates an instance with a given url
.
pub fn full_host(&self) -> Result<&str>
[src]
Host with optional port
use oapth::Config; let c0 = Config::with_url("postgres://user_name:password@endpoint/database_name"); assert_eq!(c0.full_host().unwrap(), "endpoint"); let c1 = Config::with_url("postgres://user_name:password@endpoint:1234/database_name"); assert_eq!(c1.full_host().unwrap(), "endpoint:1234");
pub fn host(&self) -> Result<&str>
[src]
Host
use oapth::Config; let c0 = Config::with_url("postgres://user_name:password@endpoint/database_name"); assert_eq!(c0.host().unwrap(), "endpoint"); let c1 = Config::with_url("postgres://user_name:password@endpoint:1234/database_name"); assert_eq!(c1.host().unwrap(), "endpoint");
pub fn name(&self) -> Result<&str>
[src]
Name
use oapth::Config; let c = Config::with_url("postgres://user_name:password@endpoint/database_name"); assert_eq!(c.name().unwrap(), "database_name");
pub fn password(&self) -> Result<&str>
[src]
Password
use oapth::Config; let c = Config::with_url("postgres://user_name:password@endpoint:1234/database_name"); assert_eq!(c.password().unwrap(), "password");
pub fn port(&self) -> Result<u16>
[src]
Port
use oapth::Config; let c = Config::with_url("postgres://user_name:password@endpoint:1234/database_name"); assert_eq!(c.port().unwrap(), 1234);
pub fn url(&self) -> &str
[src]
Url
use oapth::Config; let c = Config::with_url("postgres://user_name:password@endpoint/database_name"); assert_eq!(c.url(), "postgres://user_name:password@endpoint/database_name");
pub fn user(&self) -> Result<&str>
[src]
User
use oapth::Config; let c = Config::with_url("postgres://user_name:password@endpoint:1234/database_name"); assert_eq!(c.user().unwrap(), "user_name");
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,