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) -> Self
pub fn new(address: NetworkAddress, token: UID) -> Self
Create a new endpoint.
Sourcepub fn well_known(address: NetworkAddress, token: WellKnownToken) -> Self
pub fn well_known(address: NetworkAddress, token: WellKnownToken) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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§
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