[−][src]Struct fizyr_rpc::Server
Server that spawns peers for all accepted connections.
Implementations
impl<Listener: ServerListener> Server<Listener>
[src]
pub fn new(listener: Listener, config: Listener::Config) -> Self
[src]
Create a server on a listening socket.
The passed in config is used to create transports and peers for all accepted connections.
pub async fn bind<'a, Address: 'a>(
address: Address,
config: Listener::Config
) -> Result<Self> where
Listener: Bind<'a, Address>,
[src]
address: Address,
config: Listener::Config
) -> Result<Self> where
Listener: Bind<'a, Address>,
Create a server with a new listening socket bound to the given address.
The type of address accepted depends on the listener.
For internet transports such as TCP, the address must implement tokio::net::ToSocketAddrs
.
For unix transports, the address must implement AsRef<std::path::Path>
.
This function is asynchronous because it may perform a DNS lookup for some address types.
pub async fn run<F, R, '_>(&'_ mut self, task: F) -> Result<()> where
F: FnMut(PeerHandle<Listener::Body>) -> R,
R: Future<Output = ()> + Send + 'static,
[src]
F: FnMut(PeerHandle<Listener::Body>) -> R,
R: Future<Output = ()> + Send + 'static,
Run the server.
The server will accept connections in a loop and spawn a user task for each new peer.
pub async fn accept<'_>(&'_ mut self) -> Result<PeerHandle<Listener::Body>>
[src]
Accept a connection and spawn a peer for it.
A Peer
is spawned for the new connection,
and a PeerHandle
is returned to allow interaction with the peer.
Auto Trait Implementations
impl<Listener> RefUnwindSafe for Server<Listener> where
Listener: RefUnwindSafe,
<Listener as ServerListener>::Config: RefUnwindSafe,
Listener: RefUnwindSafe,
<Listener as ServerListener>::Config: RefUnwindSafe,
impl<Listener> Send for Server<Listener> where
Listener: Send,
<Listener as ServerListener>::Config: Send,
Listener: Send,
<Listener as ServerListener>::Config: Send,
impl<Listener> Sync for Server<Listener> where
Listener: Sync,
<Listener as ServerListener>::Config: Sync,
Listener: Sync,
<Listener as ServerListener>::Config: Sync,
impl<Listener> Unpin for Server<Listener> where
<Listener as ServerListener>::Config: Unpin,
<Listener as ServerListener>::Config: Unpin,
impl<Listener> UnwindSafe for Server<Listener> where
Listener: UnwindSafe,
<Listener as ServerListener>::Config: UnwindSafe,
Listener: UnwindSafe,
<Listener as ServerListener>::Config: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,