pub struct NodeAddress { /* private fields */ }Expand description
Identifies a specific node instance in the cluster.
The generation distinguishes node restarts at the same network address.
In simulation, this comes from the RNG seed; in production, from a
monotonic timestamp or similar mechanism.
§Examples
use moonpool_core::{NodeAddress, NetworkAddress};
use std::net::{IpAddr, Ipv4Addr};
let addr = NetworkAddress::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 4500);
let node = NodeAddress::new(addr, 1);
assert_eq!(node.generation(), 1);Implementations§
Source§impl NodeAddress
impl NodeAddress
Sourcepub fn new(address: NetworkAddress, generation: u64) -> Self
pub fn new(address: NetworkAddress, generation: u64) -> Self
Create a new node address.
Sourcepub fn address(&self) -> &NetworkAddress
pub fn address(&self) -> &NetworkAddress
The network address of this node.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
The generation counter for this node instance.
Trait Implementations§
Source§impl Clone for NodeAddress
impl Clone for NodeAddress
Source§fn clone(&self) -> NodeAddress
fn clone(&self) -> NodeAddress
Returns a duplicate of the value. Read more
1.0.0 · 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 NodeAddress
impl Debug for NodeAddress
Source§impl<'de> Deserialize<'de> for NodeAddress
impl<'de> Deserialize<'de> for NodeAddress
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
Source§impl Display for NodeAddress
impl Display for NodeAddress
Source§impl Hash for NodeAddress
impl Hash for NodeAddress
Source§impl PartialEq for NodeAddress
impl PartialEq for NodeAddress
Source§impl Serialize for NodeAddress
impl Serialize for NodeAddress
impl Eq for NodeAddress
impl StructuralPartialEq for NodeAddress
Auto Trait Implementations§
impl Freeze for NodeAddress
impl RefUnwindSafe for NodeAddress
impl Send for NodeAddress
impl Sync for NodeAddress
impl Unpin for NodeAddress
impl UnsafeUnpin for NodeAddress
impl UnwindSafe for NodeAddress
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