diff --git a/src/actor.rs b/src/actor.rs index b46b010..ae01486 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -40,7 +40,7 @@ pub type ActorHandle = tokio::task::JoinHandle; pub struct Synced; -pub trait Entity: Send + Sync { +pub trait Entity: Send { fn assert(&mut self, _t: &mut Activation, _a: M, _h: Handle) -> ActorResult { Ok(()) } @@ -71,7 +71,7 @@ enum CleanupAction { } type CleanupActions = Map; -pub type Action = Box ActorResult>; +pub type Action = Box ActorResult>; pub type PendingEventQueue = Vec; // This is what other implementations call a "Turn", renamed here to @@ -138,7 +138,7 @@ pub struct RunningActor { cleanup_actions: CleanupActions, next_task_id: u64, linked_tasks: Map, - exit_hooks: Vec) -> ActorResult>>, + exit_hooks: Vec) -> ActorResult>>, } pub struct Ref { @@ -274,7 +274,7 @@ impl<'activation> Activation<'activation> { } } - pub fn assert(&mut self, r: &Arc>, a: M) -> Handle { + pub fn assert(&mut self, r: &Arc>, a: M) -> Handle { let handle = crate::next_handle(); { let r = Arc::clone(r); @@ -291,7 +291,7 @@ impl<'activation> Activation<'activation> { handle } - pub fn assert_for_myself(&mut self, r: &Arc>, a: M) -> Handle { + pub fn assert_for_myself(&mut self, r: &Arc>, a: M) -> Handle { self.immediate_oid(r); let handle = crate::next_handle(); { @@ -315,20 +315,20 @@ impl<'activation> Activation<'activation> { } } - pub fn message(&mut self, r: &Arc>, m: M) { + pub fn message(&mut self, r: &Arc>, m: M) { let r = Arc::clone(r); self.pending.queue_for(&r).push(Box::new( move |t| r.with_entity(|e| e.message(t, m)))) } - pub fn message_for_myself(&mut self, r: &Arc>, m: M) { + pub fn message_for_myself(&mut self, r: &Arc>, m: M) { self.immediate_oid(r); let r = Arc::clone(r); self.pending.for_myself.push(Box::new( move |t| r.with_entity(|e| e.message(t, m)))) } - pub fn sync(&mut self, r: &Arc>, peer: Arc>) { + pub fn sync(&mut self, r: &Arc>, peer: Arc>) { let r = Arc::clone(r); self.pending.queue_for(&r).push(Box::new( move |t| r.with_entity(|e| e.sync(t, peer)))) @@ -515,7 +515,7 @@ impl Actor { } } - pub fn create_and_start + Send + Sync + 'static>( + pub fn create_and_start + Send + 'static>( name: tracing::Span, e: E, ) -> Arc> { @@ -653,7 +653,7 @@ impl RunningActor { self.create(InertEntity) } - pub fn create + Send + Sync + 'static>(&mut self, e: E) -> Arc> { + pub fn create + Send + 'static>(&mut self, e: E) -> Arc> { let r = self.create_inert(); r.become_entity(e); r @@ -666,7 +666,7 @@ impl RunningActor { }) } - pub fn add_exit_hook(&mut self, r: &Arc>) { + pub fn add_exit_hook(&mut self, r: &Arc>) { let r = Arc::clone(r); self.exit_hooks.push(Box::new(move |t, exit_status| { r.with_entity(|e| e.exit_hook(t, &exit_status)) @@ -802,7 +802,7 @@ impl std::fmt::Debug for Ref { } impl Cap { - pub fn guard(underlying: &Arc>) -> Arc + pub fn guard(underlying: &Arc>) -> Arc where for<'a> &'a M: Into<_Any>, for<'a> M: TryFrom<&'a _Any>, diff --git a/src/during.rs b/src/during.rs index c63c79d..373131d 100644 --- a/src/during.rs +++ b/src/during.rs @@ -7,15 +7,15 @@ use std::sync::Arc; use std::marker::PhantomData; pub struct During(Map>); -pub type DuringRetractionHandler = Box ActorResult>; +pub type DuringRetractionHandler = Box ActorResult>; pub type DuringResult = Result>, Error>; pub struct DuringEntity where - M: 'static + Send + Sync, - E: 'static + Send + Sync, - Fa: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> DuringResult, - Fm: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> ActorResult, + M: 'static + Send, + E: 'static + Send, + Fa: 'static + Send + FnMut(&mut E, &mut Activation, M) -> DuringResult, + Fm: 'static + Send + FnMut(&mut E, &mut Activation, M) -> ActorResult, { state: E, assertion_handler: Option, @@ -29,7 +29,7 @@ impl During { During(Map::new()) } - pub fn await_retraction ActorResult>( + pub fn await_retraction ActorResult>( &mut self, h: Handle, f: F, @@ -43,24 +43,24 @@ impl During { } } -pub fn entity( +pub fn entity( state: E ) -> DuringEntity DuringResult, fn (&mut E, &mut Activation, M) -> ActorResult> where - E: 'static + Send + Sync, + E: 'static + Send, { DuringEntity::new(state, None, None) } impl DuringEntity where - M: 'static + Send + Sync, - E: 'static + Send + Sync, - Fa: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> DuringResult, - Fm: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> ActorResult, + M: 'static + Send, + E: 'static + Send, + Fa: 'static + Send + FnMut(&mut E, &mut Activation, M) -> DuringResult, + Fm: 'static + Send + FnMut(&mut E, &mut Activation, M) -> ActorResult, { pub fn new(state: E, assertion_handler: Option, message_handler: Option) -> Self { DuringEntity { @@ -74,7 +74,7 @@ where pub fn on_asserted(self, assertion_handler: Fa1) -> DuringEntity where - Fa1: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> DuringResult, + Fa1: 'static + Send + FnMut(&mut E, &mut Activation, M) -> DuringResult, { DuringEntity { state: self.state, @@ -87,7 +87,7 @@ where pub fn on_message(self, message_handler: Fm1) -> DuringEntity where - Fm1: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> ActorResult, + Fm1: 'static + Send + FnMut(&mut E, &mut Activation, M) -> ActorResult, { DuringEntity { state: self.state, @@ -105,9 +105,9 @@ where impl DuringEntity<_Any, E, Fa, Fm> where - E: 'static + Send + Sync, - Fa: 'static + Send + Sync + FnMut(&mut E, &mut Activation, _Any) -> DuringResult, - Fm: 'static + Send + Sync + FnMut(&mut E, &mut Activation, _Any) -> ActorResult, + E: 'static + Send, + Fa: 'static + Send + FnMut(&mut E, &mut Activation, _Any) -> DuringResult, + Fm: 'static + Send + FnMut(&mut E, &mut Activation, _Any) -> ActorResult, { pub fn create_cap(self, ac: &mut RunningActor) -> Arc { @@ -117,10 +117,10 @@ where impl Entity for DuringEntity where - M: Send + Sync, - E: 'static + Send + Sync, - Fa: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> DuringResult, - Fm: 'static + Send + Sync + FnMut(&mut E, &mut Activation, M) -> ActorResult, + M: Send, + E: 'static + Send, + Fa: 'static + Send + FnMut(&mut E, &mut Activation, M) -> DuringResult, + Fm: 'static + Send + FnMut(&mut E, &mut Activation, M) -> ActorResult, { fn assert(&mut self, t: &mut Activation, a: M, h: Handle) -> ActorResult { match &mut self.assertion_handler { diff --git a/src/relay.rs b/src/relay.rs index 1b0df31..2812a93 100644 --- a/src/relay.rs +++ b/src/relay.rs @@ -153,8 +153,8 @@ pub fn connect_stream( ) where I: 'static + Send + AsyncRead, O: 'static + Send + AsyncWrite, - E: 'static + Send + std::marker::Sync, - F: 'static + Send + std::marker::Sync + FnMut(&mut E, &mut Activation, Arc) -> during::DuringResult + E: 'static + Send, + F: 'static + Send + FnMut(&mut E, &mut Activation, Arc) -> during::DuringResult { let i = Input::Bytes(Box::pin(i)); let o = Output::Bytes(Box::pin(o));