diff --git a/src/model/section.rs b/src/model/section.rs index aba7592..7659fa6 100644 --- a/src/model/section.rs +++ b/src/model/section.rs @@ -1,4 +1,4 @@ -use crate::section_interface::SectionId; +use crate::section_interface::SecId; use rusqlite::{Error as SqlError, Row as SqlRow, ToSql}; use std::sync::Arc; @@ -6,7 +6,7 @@ use std::sync::Arc; pub struct Section { pub id: u32, pub name: String, - pub interface_id: SectionId, + pub interface_id: SecId, } impl Section { diff --git a/src/section_interface.rs b/src/section_interface.rs index 91a5c13..f9aaf91 100644 --- a/src/section_interface.rs +++ b/src/section_interface.rs @@ -2,12 +2,12 @@ use std::iter::repeat_with; use std::sync::atomic::{AtomicBool, Ordering}; use tracing::debug; -pub type SectionId = u32; +pub type SecId = u32; pub trait SectionInterface: Send { - fn num_sections(&self) -> SectionId; - fn set_section_state(&self, id: SectionId, running: bool); - fn get_section_state(&self, id: SectionId) -> bool; + fn num_sections(&self) -> SecId; + fn set_section_state(&self, id: SecId, running: bool); + fn get_section_state(&self, id: SecId) -> bool; } pub struct MockSectionInterface { @@ -16,7 +16,7 @@ pub struct MockSectionInterface { impl MockSectionInterface { #[allow(dead_code)] - pub fn new(num_sections: SectionId) -> Self { + pub fn new(num_sections: SecId) -> Self { Self { states: repeat_with(|| AtomicBool::new(false)) .take(num_sections as usize) @@ -26,14 +26,14 @@ impl MockSectionInterface { } impl SectionInterface for MockSectionInterface { - fn num_sections(&self) -> SectionId { - self.states.len() as SectionId + fn num_sections(&self) -> SecId { + self.states.len() as SecId } - fn set_section_state(&self, id: SectionId, running: bool) { + fn set_section_state(&self, id: SecId, running: bool) { debug!(id, running, "setting section"); self.states[id as usize].store(running, Ordering::SeqCst); } - fn get_section_state(&self, id: SectionId) -> bool { + fn get_section_state(&self, id: SecId) -> bool { self.states[id as usize].load(Ordering::SeqCst) } }