mirror of https://github.com/fafhrd91/actix-net
fmt
This commit is contained in:
parent
4d22ed721d
commit
df15ef40f6
|
@ -29,7 +29,6 @@ pub struct System {
|
||||||
worker_handle: WorkerHandle,
|
worker_handle: WorkerHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl System {
|
impl System {
|
||||||
/// Create a new system.
|
/// Create a new system.
|
||||||
///
|
///
|
||||||
|
@ -151,7 +150,6 @@ pub struct SystemRunner {
|
||||||
impl SystemRunner {
|
impl SystemRunner {
|
||||||
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
||||||
pub fn run(self) -> io::Result<()> {
|
pub fn run(self) -> io::Result<()> {
|
||||||
|
|
||||||
let SystemRunner { rt, stop_rx, .. } = self;
|
let SystemRunner { rt, stop_rx, .. } = self;
|
||||||
|
|
||||||
// run loop
|
// run loop
|
||||||
|
|
|
@ -45,7 +45,6 @@ pub struct WorkerHandle {
|
||||||
sender: mpsc::UnboundedSender<WorkerCommand>,
|
sender: mpsc::UnboundedSender<WorkerCommand>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl WorkerHandle {
|
impl WorkerHandle {
|
||||||
pub(crate) fn new(sender: mpsc::UnboundedSender<WorkerCommand>) -> Self {
|
pub(crate) fn new(sender: mpsc::UnboundedSender<WorkerCommand>) -> Self {
|
||||||
Self { sender }
|
Self { sender }
|
||||||
|
@ -103,6 +102,7 @@ impl Worker {
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
/// Panics if a [System] is not registered on the current thread.
|
/// Panics if a [System] is not registered on the current thread.
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Worker {
|
pub fn new() -> Worker {
|
||||||
let id = COUNT.fetch_add(1, Ordering::Relaxed);
|
let id = COUNT.fetch_add(1, Ordering::Relaxed);
|
||||||
let name = format!("actix-rt:worker:{}", id);
|
let name = format!("actix-rt:worker:{}", id);
|
||||||
|
@ -266,15 +266,12 @@ struct WorkerRunner {
|
||||||
rx: mpsc::UnboundedReceiver<WorkerCommand>,
|
rx: mpsc::UnboundedReceiver<WorkerCommand>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Future for WorkerRunner {
|
impl Future for WorkerRunner {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
|
|
||||||
// process all items currently buffered in channel
|
// process all items currently buffered in channel
|
||||||
loop {
|
loop {
|
||||||
|
|
||||||
match ready!(Pin::new(&mut self.rx).poll_recv(cx)) {
|
match ready!(Pin::new(&mut self.rx).poll_recv(cx)) {
|
||||||
// channel closed; no more messages can be received
|
// channel closed; no more messages can be received
|
||||||
None => return Poll::Ready(()),
|
None => return Poll::Ready(()),
|
||||||
|
|
Loading…
Reference in New Issue