[−][src]Struct psk_client::builder::PskClientBuilder
The builder for a PSK client, somewhat simplifies creating a new PSK client and makes it more ergonomic.
Methods
impl<'a, H: ToSocketAddrs> PskClientBuilder<'a, H>
[src]
pub fn new(host: H) -> Self
[src]
Create a new PskClientBuilder
with the default cipher list, a None
identity and an empty key.
pub fn build(self) -> Result<PskClient, PskClientError>
[src]
Returns a new PskClient
which can be used to
use psk_client::PskClient; use std::io::Write; if let Ok(client) = PskClient::builder("127.0.0.1:4433") .identity("some-client") .key("1A2B3C4D") .build() { if let Ok(mut connection) = client.connect() { connection.write_all(b"oing").unwrap(); } }
#[must_use]
pub fn identity<S: Into<String>>(self, identity: S) -> Self
[src]
#[must_use]
pub fn identity<S: Into<String>>(self, identity: S) -> SelfSets the identity to use for this session. This is required.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .identity("some-client");
#[must_use]
pub fn key<K: AsRef<[u8]>>(self, key: K) -> Self
[src]
#[must_use]
pub fn key<K: AsRef<[u8]>>(self, key: K) -> SelfSets the key to use for this session. Must be valid hex, if not this function will panic. This is required.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .key("1A2B3C4D");
pub fn cipher(self, cipher: &'a str) -> Self
[src]
Adds a given cipher to the list of ciphers to send to the server
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .cipher("PSK-AES256-CBC-SHA");
pub fn reset_ciphers(self) -> Self
[src]
Clears the current list of ciphers, which are initialised with a default PSK set.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .reset_ciphers();
Trait Implementations
impl<'a, H: PartialEq + ToSocketAddrs> PartialEq<PskClientBuilder<'a, H>> for PskClientBuilder<'a, H>
[src]
fn eq(&self, other: &PskClientBuilder<'a, H>) -> bool
[src]
fn ne(&self, other: &PskClientBuilder<'a, H>) -> bool
[src]
impl<'a, H: Clone + ToSocketAddrs> Clone for PskClientBuilder<'a, H>
[src]
fn clone(&self) -> PskClientBuilder<'a, H>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a, H: Debug + ToSocketAddrs> Debug for PskClientBuilder<'a, H>
[src]
Auto Trait Implementations
impl<'a, H> Send for PskClientBuilder<'a, H> where
H: Send,
H: Send,
impl<'a, H> Sync for PskClientBuilder<'a, H> where
H: Sync,
H: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,