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: impl Into<String>,
database: impl Into<String>,
username: impl Into<String>,
password: impl Into<String>,
) -> Connection
pub fn new( hostname: impl Into<String>, database: impl Into<String>, username: impl Into<String>, password: impl Into<String>, ) -> 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 duplicate of the value. Read more
1.0.0 (const: unstable) · 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<String> for Connection
impl TryFrom<String> for Connection
Source§fn try_from(url: String) -> Result<Self, Self::Error>
fn try_from(url: String) -> Result<Self, Self::Error>
Converts a String 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".to_string()
.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 UnsafeUnpin 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