#![ cfg_attr( nightly, feature(doc_cfg) ) ]
#![ doc = include_str!("../README.md") ]
#![ doc ( html_root_url = "https://docs.rs/thespis_impl" ) ]
#![ deny ( missing_docs ) ]
#![ forbid ( unsafe_code ) ]
#![ allow ( clippy::suspicious_else_formatting ) ]
#![ warn
(
anonymous_parameters ,
missing_copy_implementations ,
missing_debug_implementations ,
missing_docs ,
nonstandard_style ,
rust_2018_idioms ,
single_use_lifetimes ,
trivial_casts ,
trivial_numeric_casts ,
unreachable_pub ,
unused_extern_crates ,
unused_qualifications ,
variant_size_differences ,
)]
mod actor_builder ;
mod actor_info ;
mod addr ;
mod addr_inner ;
mod envelope ;
mod error ;
mod mailbox ;
mod rx_strong ;
mod strong_count ;
mod weak_addr ;
pub use
{
actor_builder :: * ,
actor_info :: * ,
addr :: * ,
error :: * ,
mailbox :: * ,
weak_addr :: * ,
futures::{ SinkExt },
};
pub(crate) use
{
strong_count ::* ,
rx_strong ::* ,
};
use futures::Sink;
pub type BoxEnvelope<A> = Box< dyn envelope::Envelope<A> + Send >;
pub type DynError = Box< dyn std::error::Error + Send + Sync >;
pub type ChanSender<A> = Box< dyn CloneSink<'static, BoxEnvelope<A>, DynError> >;
pub type ChanReceiver<A> = Box< dyn futures::Stream<Item=BoxEnvelope<A>> + Send + Unpin >;
pub trait CloneSink<'a, Item, E>: Sink<Item, Error=E> + Unpin + Send
{
fn clone_sink( &self ) -> Box< dyn CloneSink<'a, Item, E> + 'a >;
}
impl<'a, T, Item, E> CloneSink<'a, Item, E> for T
where T: 'a + Sink<Item, Error=E> + Clone + Unpin + Send + ?Sized
{
fn clone_sink( &self ) -> Box< dyn CloneSink<'a, Item, E> + 'a >
{
Box::new( self.clone() )
}
}
mod import
{
pub(crate) use
{
thespis :: { * } ,
tracing :: { trace, debug, error, error_span, Span } ,
tracing_futures :: { Instrument } ,
async_executors :: { SpawnHandle, SpawnHandleExt, LocalSpawnHandle, LocalSpawnHandleExt, JoinHandle } ,
std ::
{
fmt ,
error :: { Error } ,
convert :: { TryFrom } ,
pin :: { Pin } ,
sync :: { Arc, Mutex, atomic::{ AtomicUsize, Ordering } } ,
panic :: { AssertUnwindSafe } ,
task :: { Context as TaskContext, Poll } ,
},
futures ::
{
stream :: { Stream, StreamExt } ,
sink :: { Sink, SinkExt } ,
future :: { FutureExt } ,
task :: { Spawn, SpawnExt, LocalSpawn, LocalSpawnExt, SpawnError } ,
},
oneshot::{ channel as oneshot, Sender as OneSender } ,
};
}