pub enum ChannelAddr {
Tcp(SocketAddr),
MetaTls(Hostname, Port),
Local(u64),
Sim(SimAddr),
Unix(SocketAddr),
}
Expand description
The type of a channel address, used to multiplex different underlying channel implementations. ChannelAddrs also have a concrete syntax: the address type (e.g., “tcp” or “local”), followed by “:”, and an address parseable to that type. For example:
tcp:127.0.0.1:1234
- localhost port 1234 over TCPtcp:192.168.0.1:1111
- 192.168.0.1 port 1111 over TCPlocal:123
- the (in-process) local port 123unix:/some/path
- the Unix socket at/some/path
Both local and TCP ports 0 are reserved to indicate “any available port” when serving.
let addr: ChannelAddr = "tcp:127.0.0.1:1234".parse().unwrap();
let ChannelAddr::Tcp(socket_addr) = addr else {
panic!()
};
assert_eq!(socket_addr.port(), 1234);
assert_eq!(socket_addr.is_ipv4(), true);
Variants§
Tcp(SocketAddr)
A socket address used to establish TCP channels. Supports both IPv4 and IPv6 address / port pairs.
MetaTls(Hostname, Port)
An address to establish TCP channels with TLS support within Meta. Composed of hostname and port.
Local(u64)
Local addresses are registered in-process and given an integral index.
Sim(SimAddr)
Sim is a simulated channel for testing.
Unix(SocketAddr)
A unix domain socket address. Supports both absolute path names as well as “abstract” names per https://manpages.debian.org/unstable/manpages/unix.7.en.html#Abstract_sockets
Implementations§
Source§impl ChannelAddr
impl ChannelAddr
Sourcepub fn any(transport: ChannelTransport) -> Self
pub fn any(transport: ChannelTransport) -> Self
The “any” address for the given transport type. This is used to servers to “any” address.
Sourcepub fn transport(&self) -> ChannelTransport
pub fn transport(&self) -> ChannelTransport
The transport used by this address.
Trait Implementations§
Source§impl Clone for ChannelAddr
impl Clone for ChannelAddr
Source§fn clone(&self) -> ChannelAddr
fn clone(&self) -> ChannelAddr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ChannelAddr
impl Debug for ChannelAddr
Source§impl<'de> Deserialize<'de> for ChannelAddr
impl<'de> Deserialize<'de> for ChannelAddr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Dispatcher<ChannelAddr> for SimDispatcher
impl Dispatcher<ChannelAddr> for SimDispatcher
Source§fn send<'life0, 'async_trait>(
&'life0 self,
addr: ChannelAddr,
data: Serialized,
) -> Pin<Box<dyn Future<Output = Result<(), SimNetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
addr: ChannelAddr,
data: Serialized,
) -> Pin<Box<dyn Future<Output = Result<(), SimNetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Display for ChannelAddr
impl Display for ChannelAddr
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§impl FromStr for ChannelAddr
impl FromStr for ChannelAddr
Source§impl Hash for ChannelAddr
impl Hash for ChannelAddr
Source§impl Named for ChannelAddr
impl Named for ChannelAddr
Source§fn typename() -> &'static str
fn typename() -> &'static str
Source§fn typehash() -> u64
fn typehash() -> u64
Source§fn arm(&self) -> Option<&'static str>
fn arm(&self) -> Option<&'static str>
Source§fn typeid() -> TypeId
fn typeid() -> TypeId
Source§impl Ord for ChannelAddr
impl Ord for ChannelAddr
Source§fn cmp(&self, other: &ChannelAddr) -> Ordering
fn cmp(&self, other: &ChannelAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ChannelAddr
impl PartialEq for ChannelAddr
Source§impl PartialOrd for ChannelAddr
impl PartialOrd for ChannelAddr
Source§impl Serialize for ChannelAddr
impl Serialize for ChannelAddr
impl Eq for ChannelAddr
impl StructuralPartialEq for ChannelAddr
Auto Trait Implementations§
impl Freeze for ChannelAddr
impl RefUnwindSafe for ChannelAddr
impl Send for ChannelAddr
impl Sync for ChannelAddr
impl Unpin for ChannelAddr
impl UnwindSafe for ChannelAddr
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
Source§impl<T> Checkpointable for Twhere
T: RemoteMessage + Clone,
impl<T> Checkpointable for Twhere
T: RemoteMessage + Clone,
Source§type State = T
type State = T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more