mod subscribable_all;
pub use subscribable_all::*;
mod subscribable_err;
pub use subscribable_err::*;
mod subscribable_pure;
pub use subscribable_pure::*;
mod subscribable_comp;
use crate::observer::Observer;
use crate::subscription::SubscriptionLike;
use std::sync::{Arc, Mutex};
pub use subscribable_comp::*;
pub trait IntoShared {
type Shared: Sync + Send + 'static;
fn to_shared(self) -> Self::Shared;
}
pub trait RawSubscribable<Subscriber> {
type Unsub: SubscriptionLike + 'static;
fn raw_subscribe(self, subscriber: Subscriber) -> Self::Unsub;
}
impl<Item, Err> IntoShared for Box<dyn Observer<Item, Err> + Send + Sync>
where
Item: 'static,
Err: 'static,
{
type Shared = Self;
#[inline(always)]
fn to_shared(self) -> Self::Shared { self }
}
impl<S> IntoShared for Arc<Mutex<S>>
where
S: Send + Sync + 'static,
{
type Shared = Self;
#[inline(always)]
fn to_shared(self) -> Self::Shared { self }
}