Add Program model
Also expose types for collections of Sections and Programs
This commit is contained in:
parent
46d90b4e84
commit
a509303bc2
@ -15,6 +15,7 @@ tokio = { version = "0.2.22", features = ["rt-core", "time", "sync", "macros", "
|
||||
tracing = { version = "0.1.19", features = ["log"] }
|
||||
tracing-futures = "0.2.4"
|
||||
pin-project = "0.4.23"
|
||||
im = "15.0.0"
|
||||
|
||||
[dependencies.tracing-subscriber]
|
||||
version = "0.2.11"
|
||||
|
@ -1,3 +1,5 @@
|
||||
mod program;
|
||||
mod section;
|
||||
|
||||
pub use section::{Section, SectionRef};
|
||||
pub use program::{Program, ProgramId, ProgramItem, ProgramRef, ProgramSequence, Programs};
|
||||
pub use section::{Section, SectionId, SectionRef, Sections};
|
||||
|
23
src/model/program.rs
Normal file
23
src/model/program.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use std::{time::Duration, sync::Arc};
|
||||
use super::section::SectionId;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ProgramItem {
|
||||
pub section_id: SectionId,
|
||||
pub duration: Duration,
|
||||
}
|
||||
|
||||
pub type ProgramSequence = Vec<ProgramItem>;
|
||||
|
||||
pub type ProgramId = u32;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Program {
|
||||
pub id: ProgramId,
|
||||
pub name: String,
|
||||
pub sequence: ProgramSequence,
|
||||
}
|
||||
|
||||
pub type ProgramRef = Arc<Program>;
|
||||
|
||||
pub type Programs = im::OrdMap<ProgramId, ProgramRef>;
|
@ -27,3 +27,5 @@ impl Section {
|
||||
}
|
||||
|
||||
pub type SectionRef = Arc<Section>;
|
||||
|
||||
pub type Sections = im::OrdMap<SectionId, SectionRef>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user