use std::fmt::Debug;
use crate::core::utils::Sealed;
use crate::protocol::{ComponentId, DeviceId, Endpoint, MaybeVersioned, SystemId, Unset};
pub trait NodeKind: Clone + Debug + Sync + Send + Sealed {}
#[derive(Clone, Copy, Debug)]
pub struct Proxy;
impl Sealed for Proxy {}
impl NodeKind for Proxy {}
#[derive(Clone, Debug)]
pub struct Edge<V: MaybeVersioned> {
pub(crate) device_id: DeviceId,
pub(crate) endpoint: Endpoint<V>,
}
impl<V: MaybeVersioned> Sealed for Edge<V> {}
impl<V: MaybeVersioned> NodeKind for Edge<V> {}
impl<V: MaybeVersioned> Edge<V> {
pub(crate) fn new(endpoint: Endpoint<V>) -> Self {
let device_id = DeviceId::new(endpoint.id());
Self {
endpoint,
device_id,
}
}
}
pub trait MaybeConnConf: Debug + Send + Sealed {}
impl MaybeConnConf for Unset {}
pub trait HasConnConf: MaybeConnConf {
fn is_repairable(&self) -> bool {
false
}
}
pub trait MaybeSystemId: Clone + Copy + Debug + Sync + Send + Sealed {}
impl MaybeSystemId for Unset {}
#[derive(Copy, Clone, Debug)]
pub struct HasSystemId(pub SystemId);
impl Sealed for HasSystemId {}
impl MaybeSystemId for HasSystemId {}
pub trait MaybeComponentId: Clone + Debug + Sync + Send + Sealed {}
impl MaybeComponentId for Unset {}
#[derive(Copy, Clone, Debug)]
pub struct HasComponentId(pub ComponentId);
impl Sealed for HasComponentId {}
impl MaybeComponentId for HasComponentId {}