#[doc(hidden)]
pub mod sealing {
pub trait Sealed {}
}
#[doc(hidden)]
pub trait TypedIoSurface: sealing::Sealed {}
#[doc(hidden)]
pub trait ComponentBoundSurface: sealing::Sealed {
type Connection: crate::model::connection::ConnectionPayload;
}
#[cfg(test)]
mod tests {
use super::{ComponentBoundSurface, TypedIoSurface};
use crate::participant::metadata::ParticipantKind;
use crate::participant::spec::ParticipantSpec;
use crate::prelude::*;
#[phoxal::driver(id = "marker-driver")]
struct MarkerDriver;
impl Participant for MarkerDriver {
async fn setup(
&self,
_ctx: &mut SetupContext<Self>,
_config: Self::Config,
) -> Result<(Self::State, Self::Api)> {
Ok(((), ()))
}
}
#[phoxal::brain]
struct MarkerBrain;
impl Participant for MarkerBrain {
async fn setup(
&self,
_ctx: &mut SetupContext<Self>,
_config: Self::Config,
) -> Result<(Self::State, Self::Api)> {
Ok(((), ()))
}
}
#[test]
fn kind_macros_emit_their_markers() {
fn assert_driver<T: ComponentBoundSurface + TypedIoSurface>() {}
assert_driver::<MarkerDriver>();
}
#[test]
fn the_brain_marker_is_checked_only() {
fn assert_checked<T: TypedIoSurface>() {}
assert_checked::<MarkerBrain>();
assert_eq!(<MarkerBrain as ParticipantSpec>::ID, "brain");
assert_eq!(
<MarkerBrain as ParticipantSpec>::KIND,
ParticipantKind::Brain
);
}
}