[][src]Struct oapth::Config

pub struct Config { /* fields omitted */ }

Configuration to connect to a database

Implementations

impl Config[src]

pub fn with_url<I>(url: I) -> Self where
    I: Into<String>, 
[src]

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

impl Debug for Config[src]

Auto Trait Implementations

impl Send for Config

impl Sync for Config

impl Unpin for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.