pub enum ConnectionEndpoint {
Tcp {
host: String,
port: u16,
},
DomainSocket {
directory: PathBuf,
name: String,
},
}Expand description
Represents a connection endpoint for Hyper database.
Supports different transport mechanisms:
- TCP:
tab.tcp://host:port - Unix Domain Socket:
tab.domain://<directory>/domain/<name>(Unix only) - Windows Named Pipe:
tab.pipe://<host>/pipe/<name>(Windows only, future)
Variants§
Tcp
TCP endpoint: tab.tcp://host:port
DomainSocket
Unix Domain Socket: tab.domain://<directory>/domain/<name>
Implementations§
Source§impl ConnectionEndpoint
impl ConnectionEndpoint
Sourcepub fn domain_socket(
directory: impl Into<PathBuf>,
name: impl Into<String>,
) -> Self
pub fn domain_socket( directory: impl Into<PathBuf>, name: impl Into<String>, ) -> Self
Creates a new Unix Domain Socket endpoint.
Sourcepub fn parse(descriptor: &str) -> Result<Self>
pub fn parse(descriptor: &str) -> Result<Self>
Parses a connection descriptor string.
Supported formats:
tab.tcp://host:portorhost:port→ TCPtab.domain://<dir>/domain/<name>→ Unix Domain Sockettab.pipe://<host>/pipe/<name>→ Named Pipe (future)
§Errors
Returns Error (connection) when:
- The descriptor has the
tab.domain://prefix but is missing the/domain/separator, has an empty socket name, or is used on a non-Unix platform. - The descriptor has the
tab.pipe://prefix but malformed/pipe/segment, empty name, or is used on a non-Windows platform. - The TCP descriptor cannot be parsed into a
host:portpair, or the port is not a validu16.
Sourcepub fn to_descriptor(&self) -> String
pub fn to_descriptor(&self) -> String
Returns the connection descriptor string format.
This is the format used by Hyper for --listen-connection and --callback-connection.
Sourcepub fn socket_path(&self) -> Option<PathBuf>
pub fn socket_path(&self) -> Option<PathBuf>
Returns the socket file path for Unix Domain Sockets.
Sourcepub fn is_domain_socket(&self) -> bool
pub fn is_domain_socket(&self) -> bool
Returns true if this is a Unix Domain Socket endpoint.
Trait Implementations§
Source§impl Clone for ConnectionEndpoint
impl Clone for ConnectionEndpoint
Source§fn clone(&self) -> ConnectionEndpoint
fn clone(&self) -> ConnectionEndpoint
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 ConnectionEndpoint
impl Debug for ConnectionEndpoint
Source§impl Display for ConnectionEndpoint
impl Display for ConnectionEndpoint
Source§impl PartialEq for ConnectionEndpoint
impl PartialEq for ConnectionEndpoint
Source§fn eq(&self, other: &ConnectionEndpoint) -> bool
fn eq(&self, other: &ConnectionEndpoint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ConnectionEndpoint
impl StructuralPartialEq for ConnectionEndpoint
Auto Trait Implementations§
impl Freeze for ConnectionEndpoint
impl RefUnwindSafe for ConnectionEndpoint
impl Send for ConnectionEndpoint
impl Sync for ConnectionEndpoint
impl Unpin for ConnectionEndpoint
impl UnsafeUnpin for ConnectionEndpoint
impl UnwindSafe for ConnectionEndpoint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request