pub struct Addr { /* private fields */ }Expand description
Unique actor addresses based on IP, PORT and names. Some fields are later extension points
Implementations§
Source§impl Addr
impl Addr
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
A new local actor address - bound to be unique. Actors with same name will have different ids based on system ports even if multiple instances of the arrows systems are running on the same node
Examples found in repository?
examples/send.rs (line 14)
4fn main() {
5 let m1 = Msg::from_text("Message to new_actor");
6 let m2 = Msg::from_text("Message to new_actor");
7 let m3 = Msg::from_text("Message to new_actor");
8
9 send!("demo_actor", (m1, m2, m3));
10
11 let mut m4 = Msg::from_text("Message to another_actor");
12
13 //Impersonate sender as "new_actor"
14 m4.set_from(&Addr::new("demo_actor"));
15
16 send!("another_actor", m4);
17}Sourcepub fn remote(name: &str, hostport: &str) -> Self
pub fn remote(name: &str, hostport: &str) -> Self
An actor running on a different local or remote system
Examples found in repository?
examples/scratch.rs (line 13)
5pub fn main() {
6 let m1 = Msg::from_text("Message to actor1");
7 let m2 = Msg::from_text("Message to actor1");
8 let m3 = Msg::from_text("Message to actor2");
9 let m4 = Msg::from_text("Message to actor1");
10 let m5 = Msg::from_text("Message to actor1");
11 send!("actor1", (m1, m2), "actor2", (m3), "actor1", (m4, m5));
12
13 let remote_addr1 = Addr::remote("actor1", "10.10.10.10:7171");
14 let remote_addr2 = Addr::remote("actor2", "11.11.11.11:8181");
15
16 let m1 = Msg::from_text("Message to remote actor1");
17 let m2 = Msg::from_text("Message to remote actor1");
18 let m3 = Msg::from_text("Message to remote actor2");
19 let m4 = Msg::from_text("Message to remote actor2");
20
21 send!(remote_addr1, (m1, m2), remote_addr2, (m3, m4));
22}Sourcepub fn get_host_ip(&self) -> IpAddr
pub fn get_host_ip(&self) -> IpAddr
Address host ip
Sourcepub fn is_ip_local(ip: IpAddr) -> bool
pub fn is_ip_local(ip: IpAddr) -> bool
Needed for support remoting - used to decide if listener should be booted if not already up if message comes in
Sourcepub fn is_local_ip(&self) -> bool
pub fn is_local_ip(&self) -> bool
Mostly for routing decisions
Sourcepub fn is_local_port(&self) -> bool
pub fn is_local_port(&self) -> bool
Routing
Sourcepub fn listen_addr() -> Self
pub fn listen_addr() -> Self
The address of the listener
Examples found in repository?
More examples
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Addr
impl<'de> Deserialize<'de> for Addr
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 Addr
impl StructuralPartialEq for Addr
Auto Trait Implementations§
impl Freeze for Addr
impl RefUnwindSafe for Addr
impl Send for Addr
impl Sync for Addr
impl Unpin for Addr
impl UnwindSafe for Addr
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