Skip to content

Commit

Permalink
type-safer offset ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
kstep committed Feb 28, 2021
1 parent 5d8f9d2 commit ac6395e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/model/offset.rs
Expand Up @@ -11,11 +11,13 @@ pub enum Offset<T> {
Uri(IdBuf<T>),
}

impl<T> Offset<T> {
impl Offset<idtypes::Track> {
pub fn for_position(position: u64) -> Offset<idtypes::Track> {
Offset::Position(Duration::from_millis(position))
}
}

impl<T> Offset<T> {
pub fn for_uri(uri: &Id<T>) -> Offset<T>
where
T: PlayableIdType,
Expand Down

0 comments on commit ac6395e

Please sign in to comment.