#[doc(hidden)]
pub mod sealing {
pub trait Sealed {}
}
#[doc(hidden)]
pub trait TypedIoSurface: sealing::Sealed {}
#[doc(hidden)]
pub trait ComponentBoundSurface: sealing::Sealed {}
#[doc(hidden)]
#[diagnostic::on_unimplemented(
message = "`{Self}` is clockless and cannot own a scheduled step",
label = "scheduled steps are available only on services and drivers"
)]
pub trait SchedulableSurface {}
#[doc(hidden)]
pub trait WorldAuthoritySurface: sealing::Sealed {}
#[cfg(test)]
mod tests {
use super::{ComponentBoundSurface, SchedulableSurface, TypedIoSurface, WorldAuthoritySurface};
use crate::participant::spec::ParticipantSpec;
use crate::prelude::*;
use phoxal_runtime_contract::metadata::ParticipantKind;
#[phoxal::simulator(id = "marker-simulator")]
struct MarkerSimulator;
impl Participant for MarkerSimulator {
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_simulator<T: WorldAuthoritySurface + ComponentBoundSurface + TypedIoSurface>() {}
assert_simulator::<MarkerSimulator>();
}
#[test]
fn the_brain_marker_is_checked_and_schedulable_only() {
fn assert_checked_schedulable<T: TypedIoSurface + SchedulableSurface>() {}
assert_checked_schedulable::<MarkerBrain>();
assert_eq!(<MarkerBrain as ParticipantSpec>::ID, "brain");
assert_eq!(
<MarkerBrain as ParticipantSpec>::KIND,
ParticipantKind::Brain
);
}
}