sim_lib_music_serial/
reading.rs1use crate::{PlannedSerialEvent, SerialRole};
4
5#[derive(Copy, Clone, Debug, PartialEq, Eq)]
7pub enum SerialReading {
8 StructuralPlan,
10 DeclaredRoles,
12 AllSounding,
14}
15
16impl SerialReading {
17 pub const fn as_str(self) -> &'static str {
19 match self {
20 Self::StructuralPlan => "structural-plan",
21 Self::DeclaredRoles => "declared-roles",
22 Self::AllSounding => "all-sounding",
23 }
24 }
25
26 pub(crate) const fn includes_event(self, event: &PlannedSerialEvent) -> bool {
27 match self {
28 Self::StructuralPlan => matches!(event.role, SerialRole::Structural),
29 Self::DeclaredRoles | Self::AllSounding => true,
30 }
31 }
32}