pub struct ConnectionBuilder { /* private fields */ }
Expand description
A builder for creating a new endpoint.
Implementations§
Source§impl ConnectionBuilder
impl ConnectionBuilder
Sourcepub fn new(
remote_name: &str,
remote_addr: SocketAddr,
app_name: &str,
app_version: &str,
protocol_version: &str,
status: Status,
cert: &[u8],
key: &[u8],
) -> Result<Self>
pub fn new( remote_name: &str, remote_addr: SocketAddr, app_name: &str, app_version: &str, protocol_version: &str, status: Status, cert: &[u8], key: &[u8], ) -> Result<Self>
Creates a new builder with the remote address, certificate, and key.
§Errors
Returns an error if the certificate or key is invalid.
Sourcepub fn root_certs<I>(&mut self, certs: I) -> Result<&mut Self>
pub fn root_certs<I>(&mut self, certs: I) -> Result<&mut Self>
Sets the root certificates for the connection.
§Errors
Returns an error if any of the certificates are invalid.
Sourcepub fn add_root_certs(&mut self, rd: &mut dyn BufRead) -> Result<&mut Self>
pub fn add_root_certs(&mut self, rd: &mut dyn BufRead) -> Result<&mut Self>
Adds root certificates to the certificate store.
It reads certificates from the given reader, filtering out any PEM sections.
§Errors
Returns an error if the reader is invalid or the certificates are invalid.
Sourcepub fn local_addr(&mut self, addr: IpAddr) -> &mut Self
pub fn local_addr(&mut self, addr: IpAddr) -> &mut Self
Sets the local address to bind to.
This is only necessary if the unspecified address (:: for IPv6 and 0.0.0.0 for IPv4) is not desired.
Sourcepub async fn connect(&self) -> Result<Connection>
pub async fn connect(&self) -> Result<Connection>
Connects to the server and performs a handshake.
§Errors
Returns an error if the connection fails or the server requires a different protocol version.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionBuilder
impl RefUnwindSafe for ConnectionBuilder
impl Send for ConnectionBuilder
impl Sync for ConnectionBuilder
impl Unpin for ConnectionBuilder
impl UnwindSafe for ConnectionBuilder
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