pub struct Endpoint {
pub address: NetworkAddress,
pub token: UID,
}Expand description
Endpoint = Address + Token (FDB-compatible).
Represents a unique destination for messages. The combination of network address and UID token allows direct addressing without service discovery.
§Examples
use moonpool_core::{Endpoint, NetworkAddress, UID, WellKnownToken};
use std::net::{IpAddr, Ipv4Addr};
let addr = NetworkAddress::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 4500);
let endpoint = Endpoint::well_known(addr, WellKnownToken::Ping);
assert!(endpoint.token.is_well_known());Fields§
§address: NetworkAddressNetwork address for this endpoint.
token: UIDUnique token identifying the endpoint.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(address: NetworkAddress, token: UID) -> Endpoint
pub fn new(address: NetworkAddress, token: UID) -> Endpoint
Create a new endpoint.
Sourcepub fn well_known(address: NetworkAddress, token: WellKnownToken) -> Endpoint
pub fn well_known(address: NetworkAddress, token: WellKnownToken) -> Endpoint
Create a well-known endpoint.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Endpoint
impl<'de> Deserialize<'de> for Endpoint
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Endpoint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Endpoint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Endpoint
impl Serialize for Endpoint
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Endpoint
impl StructuralPartialEq for Endpoint
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnwindSafe for Endpoint
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)