pub struct Server { /* private fields */ }Expand description
Represents a registration Server in a distributed system.
Implementations§
Source§impl Server
impl Server
Sourcepub async fn new(address: &str) -> Result<Self, LiquidError>
pub async fn new(address: &str) -> Result<Self, LiquidError>
Create a new Server running on the given address in the format of
IP:Port.
Sourcepub async fn accept_new_connections(&mut self) -> Result<(), LiquidError>
pub async fn accept_new_connections(&mut self) -> Result<(), LiquidError>
A blocking function that allows a Server to listen for connections
from newly started Clients. When a new Client connects to this
Server, we add the connection to our directory for sending
ControlMsg::Kill messages, but do not listen for further messages
from the Client since this is not required for performing simple
registration.
Sourcepub async fn send_msg(
&mut self,
target_id: usize,
network_name: &str,
message: ControlMsg,
) -> Result<(), LiquidError>
pub async fn send_msg( &mut self, target_id: usize, network_name: &str, message: ControlMsg, ) -> Result<(), LiquidError>
Send the given message to a Client running in the network with
the given network_name and with the given target_id.
Sourcepub async fn broadcast(
&mut self,
message: ControlMsg,
network_name: &str,
) -> Result<(), LiquidError>
pub async fn broadcast( &mut self, message: ControlMsg, network_name: &str, ) -> Result<(), LiquidError>
Broadcast the given message to all currently connected [Clients]
in the network with the given network_name
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more