TimeCodeTrait

Trait TimeCodeTrait 

Source
pub trait TimeCodeTrait {
    // Required method
    fn to_timecode(&self) -> Result<TimeCode, String>;
}
Expand description

trait to implement for types that can be converted to a TimeCode

Required Methods§

Source

fn to_timecode(&self) -> Result<TimeCode, String>

Attempts to convert the type to TimeCode

use title_parser::timecode::{TimeCodeTrait};

let tc_string = "00:01:14.815";
let tc = tc_string.to_timecode().unwrap();
assert_eq!(tc.string, tc_string);

// bad timecode
let tc_string = "00:01:67.815";
let tc = tc_string.to_timecode();
assert_eq!(tc, Err("invalid timecode".to_string()));

Implementations on Foreign Types§

Source§

impl TimeCodeTrait for str

Implementors§