pub struct Connection { /* private fields */ }
Expand description
Connection details for script clients.
Defines the credentials, hostname and database to connect to.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(
hostname: &str,
database: &str,
username: &str,
password: &str,
) -> Connection
pub fn new( hostname: &str, database: &str, username: &str, password: &str, ) -> Connection
Creates a new connection.
Will use the HTTPS by default, unless changes.
§Examples
use fm_script_client::Connection;
let connection = Connection::new("example.com", "test_sb", "foo", "bar");
Sourcepub fn without_tls(self, disable_tls: bool) -> Self
pub fn without_tls(self, disable_tls: bool) -> Self
Disables TLS which forces the client to fall back to HTTP.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
Returns a copy 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 Connection
impl Debug for Connection
Source§impl TryFrom<&str> for Connection
impl TryFrom<&str> for Connection
Source§fn try_from(url: &str) -> Result<Self, Self::Error>
fn try_from(url: &str) -> Result<Self, Self::Error>
Converts a &str
into a Connection
.
Connection strings must follow this format:
https://username:password@example.com/database
§Examples
use fm_script_client::Connection;
let connection: Connection = "https://username:password@example.com/database"
.try_into()
.unwrap();
Source§impl TryFrom<Url> for Connection
impl TryFrom<Url> for Connection
Source§fn try_from(url: Url) -> Result<Self, Self::Error>
fn try_from(url: Url) -> Result<Self, Self::Error>
Converts a Url
into a Connection
.
URLs must contain a hostname, username and password, as well as a database as the path portion.
§Examples
use fm_script_client::Connection;
use url::Url;
let connection: Connection = Url::parse("https://username:password@example.com/database")
.unwrap()
.try_into()
.unwrap();
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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