Adding method to validate event_type of SongEvent
This commit is contained in:
1 file changed
+18
@@ -7,5 +7,23 @@ pub struct SongEvent {
|
|||||||
pub event_time: time::OffsetDateTime
|
pub event_time: time::OffsetDateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SongEvent {
|
||||||
|
pub fn is_event_type_valid(&self) -> bool {
|
||||||
|
match self.event_type.as_str() {
|
||||||
|
SONG_EVENT_TYPE_PLAY => {
|
||||||
|
true
|
||||||
|
},
|
||||||
|
SONG_EVENT_TYPE_PAUSE => {
|
||||||
|
true
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Song Event Type - Play
|
||||||
pub const SONG_EVENT_TYPE_PLAY: &str = "PLAY";
|
pub const SONG_EVENT_TYPE_PLAY: &str = "PLAY";
|
||||||
|
/// Song Event Type - PAUSE
|
||||||
pub const SONG_EVENT_TYPE_PAUSE: &str = "PAUSE";
|
pub const SONG_EVENT_TYPE_PAUSE: &str = "PAUSE";
|
||||||
Reference in new issue
Block a user