reorginise
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
use iced::Subscription;
|
||||
|
||||
use common::{Service, ServicePayloadKind};
|
||||
use common::{Service, ServiceEvent};
|
||||
|
||||
/// Conversion from a route key to the subscription backing it.
|
||||
///
|
||||
@@ -12,13 +12,16 @@ use common::{Service, ServicePayloadKind};
|
||||
/// both `Service` and `Subscription` are foreign to this crate — the orphan
|
||||
/// rule blocks a foreign trait (`From`) on a foreign type (`Subscription`).
|
||||
pub trait IntoSubscription {
|
||||
fn into_subscription(self) -> Subscription<ServicePayloadKind>;
|
||||
fn into_subscription(self) -> Subscription<ServiceEvent>;
|
||||
}
|
||||
|
||||
impl IntoSubscription for Service {
|
||||
fn into_subscription(self) -> Subscription<ServicePayloadKind> {
|
||||
match self {
|
||||
Service::Clock(_) => service_datetime::ClockTicker::run(),
|
||||
fn into_subscription(self) -> Subscription<ServiceEvent> {
|
||||
match self.0 {
|
||||
key if key.starts_with(service_datetime::NAMESPACE) => {
|
||||
service_datetime::ClockTicker::run()
|
||||
}
|
||||
_ => Subscription::none(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user