This commit is contained in:
Rob Ede 2021-01-29 20:47:22 +00:00
parent 4d22ed721d
commit df15ef40f6
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
2 changed files with 1 additions and 6 deletions

View File

@ -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

View File

@ -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(()),