Skip to content

Commit 4f211f4

Browse files
committed
reduced warnings
1 parent 9422748 commit 4f211f4

File tree

9 files changed

+12
-30
lines changed

9 files changed

+12
-30
lines changed

src/uactor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "uactor"
3-
version = "0.13.1"
3+
version = "0.13.2"
44
edition = "2021"
55
repository = "https://github.com/EnvOut/uactor"
66
license = "MIT"

src/uactor/src/actor/abstract_actor.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
use crate::actor::context::{ActorContext, ContextResult};
1+
use crate::actor::context::ActorContext;
22
use crate::actor::message::Message;
33
use std::future::Future;
4-
use std::pin::Pin;
54
use std::sync::Arc;
6-
use std::sync::mpsc::Sender;
75
use crate::actor::select::{ActorSelect, SelectError, SelectResult};
8-
use crate::data::datasource::{DataSource, DataSourceErrors};
96

107
pub trait State: std::any::Any + Send + 'static {}
118
impl<T: std::any::Any + Send + 'static> State for T {}
129

1310
use crate::dependency_injection::Inject;
14-
use crate::system::System;
1511

1612
#[allow(unused_variables)]
1713
pub trait Actor: Sized + Unpin + 'static {
@@ -65,7 +61,7 @@ pub trait Actor: Sized + Unpin + 'static {
6561
}
6662

6763
#[inline]
68-
fn on_die(mut self, ctx: &mut Self::Context, state: &Self::State) -> impl Future<Output = ()> + Send {
64+
fn on_die(self, ctx: &mut Self::Context, state: &Self::State) -> impl Future<Output = ()> + Send {
6965
async {}
7066
}
7167
}
@@ -106,9 +102,9 @@ pub trait MessageSender<M>
106102
where
107103
M: Message,
108104
{
109-
async fn send(&self, msg: M) -> crate::data::data_publisher::DataPublisherResult;
110-
async fn ask<A>(
105+
fn send(&self, msg: M) -> impl std::future::Future<Output = crate::data::data_publisher::DataPublisherResult> + Send;
106+
fn ask<A>(
111107
&self,
112108
f: impl FnOnce(tokio::sync::oneshot::Sender<A>) -> M,
113-
) -> Result<A, crate::data::data_publisher::DataPublisherErrors>;
109+
) -> impl std::future::Future<Output = Result<A, crate::data::data_publisher::DataPublisherErrors>> + Send;
114110
}

src/uactor/src/actor/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::actor::abstract_actor::{Actor, Handler};
1+
use crate::actor::abstract_actor::Actor;
22
use crate::actor::message::Message;
33
use crate::data::datasource::{DataSource, DataSourceErrors, DataSourceResult};
44
use std::future::pending;

src/uactor/src/data/data_publisher.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ mod async_sender {
2626

2727
impl<T: ?Sized> TryClone for &T {
2828
#[inline(always)]
29-
#[rustc_diagnostic_item = "noop_method_clone"]
3029
fn try_clone(&self) -> Result<Self, TryCloneError> {
3130
Ok(*self)
3231
}

src/uactor/src/data/datasource.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use std::net::{Ipv4Addr, SocketAddrV4};
2-
use std::pin::Pin;
3-
use std::task::{Context, Poll};
42
use tokio::net::{TcpListener, TcpStream};
53
use tokio::sync::{broadcast, mpsc, oneshot, watch};
64
use tokio::time::Interval;
75

8-
use crate::actor::message::{IntervalMessage, Message};
6+
use crate::actor::message::IntervalMessage;
97

108
pub type DataSourceResult<T> = Result<T, DataSourceErrors>;
119

src/uactor/src/data/datasource_decorator/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::actor::message::Message;
22
use crate::data::datasource::DataSource;
33
use crate::data::datasource_decorator::timeout_impl::TimeoutDecorator;
4-
use futures::FutureExt;
54
use std::time::Duration;
65

76
mod timeout_impl;

src/uactor/src/data/datasource_decorator/timeout_impl.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use crate::actor::message::Message;
22
use crate::data::datasource::{DataSource, DataSourceErrors, DataSourceResult};
3-
use futures::{FutureExt, TryFutureExt};
3+
use futures::FutureExt;
44
use std::future::Future;
55
use std::time::Duration;
6-
use tokio_stream::StreamExt;
7-
86
#[derive(derive_more::Constructor)]
97
pub struct TimeoutDecorator<M, D>
108
where

src/uactor/src/dependency_injection/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub trait Inject {
4141
}
4242

4343
pub mod inject_impls {
44-
use crate::actor::abstract_actor::Actor;
4544
use crate::dependency_injection::{Inject, InjectError};
4645
use crate::system::System;
4746

src/uactor/src/system/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
use crate::actor;
21
use crate::actor::abstract_actor::{Actor, Handler};
32
use crate::actor::context::actor_registry::{ActorRegistry, ActorRegistryErrors};
43
use crate::actor::context::extensions::{ExtensionErrors, Extensions, Service};
54
use crate::actor::context::ActorContext;
65
use crate::actor::message::Message;
7-
use crate::actor::select::{ActorSelect, SelectResult};
6+
use crate::actor::select::ActorSelect;
87
use crate::aliases::ActorName;
9-
use crate::data::data_publisher::{DataPublisher, TryClone, TryCloneError};
8+
use crate::data::data_publisher::{DataPublisher, TryCloneError};
109
use crate::dependency_injection::{Inject, InjectError};
1110
use crate::system::builder::SystemBuilder;
12-
use std::any::Any;
13-
use std::collections::HashMap;
14-
use std::pin::pin;
1511
use std::sync::Arc;
1612
use tokio::sync::mpsc::UnboundedSender;
17-
use tokio::sync::{oneshot, RwLock};
1813
use tokio::task::JoinHandle;
1914
use crate::system::global::GlobalSystem;
2015

@@ -36,7 +31,6 @@ pub enum ActorRunningError {
3631
pub struct System {
3732
name: Arc<str>,
3833
extensions: Extensions,
39-
initialized_actors: HashMap<Arc<str>, oneshot::Sender<Box<dyn Any + Send>>>,
4034
actor_registry: ActorRegistry,
4135
}
4236

@@ -55,7 +49,7 @@ impl System {
5549
M: Message + Send + 'static,
5650
R: From<(ActorName, UnboundedSender<M>, A::State)>,
5751
{
58-
let (mut tx, rx) = tokio::sync::mpsc::unbounded_channel::<M>();
52+
let (tx, rx) = tokio::sync::mpsc::unbounded_channel::<M>();
5953

6054
let actor_name: Arc<str> = actor_name.to_owned().into();
6155
let state = A::State::default();
@@ -285,7 +279,6 @@ pub mod builder {
285279
Arc::from(self.name.as_str()),
286280
self.extensions,
287281
Default::default(),
288-
Default::default(),
289282
)
290283
}
291284
}

0 commit comments

Comments
 (0)