rill_server/actors/server/
link.rs

1use super::RillServer;
2use derive_more::From;
3use meio::{Address, Interaction, InteractionTask};
4use meio_connect::server::HttpServerLink;
5
6/// Link to a server.
7#[derive(Debug, From)]
8pub struct ServerLink {
9    address: Address<RillServer>,
10}
11
12/// The notification when a public server binded to a port.
13pub struct WaitPublicEndpoint;
14
15impl Interaction for WaitPublicEndpoint {
16    type Output = HttpServerLink;
17}
18
19impl ServerLink {
20    /// Interaction to wait for the public server binded.
21    pub fn wait_public_endpoint(&self) -> InteractionTask<WaitPublicEndpoint> {
22        self.address.interact(WaitPublicEndpoint)
23    }
24}
25
26/// The notification when a private server binded to a port.
27pub struct WaitPrivateEndpoint;
28
29impl Interaction for WaitPrivateEndpoint {
30    type Output = HttpServerLink;
31}
32
33impl ServerLink {
34    /// Interaction to wait for the private server binded.
35    pub fn wait_private_endpoint(&self) -> InteractionTask<WaitPrivateEndpoint> {
36        self.address.interact(WaitPrivateEndpoint)
37    }
38}