Struct video_timecode::Timecode
[−]
[src]
pub struct Timecode<FrameRate> {
pub frame_number: u32,
pub hour: u8,
pub minute: u8,
pub second: u8,
pub frame: u8,
// some fields omitted
}Representation of a timecode
Note: Currently the user-facing values are open properties. These may be replaced by getters to facilitate lazy evaluation.
Example
use video_timecode::*; let timecode = match Timecode::<FrameRate24>::new(0, 0, 0, 10) { Ok(tc) => tc, _ => panic!() }; assert_eq!(timecode.frame_number, 10); let timecode = match Timecode::<FrameRate24>::new(0, 0, 10, 0) { Ok(tc) => tc, _ => panic!() }; assert_eq!(timecode.frame_number, 240); let timecode = Timecode::<FrameRate24>::from(240); assert_eq!(timecode.hour, 0); assert_eq!(timecode.minute, 0); assert_eq!(timecode.second, 10); assert_eq!(timecode.frame, 0); assert_eq!(timecode.frame_number, 240);
Fields
frame_number: u32
Frame number. The count of frames after 00:00:00:00
hour: u8
minute: u8
second: u8
frame: u8
Methods
impl<T> Timecode<T>[src]
fn new(
hour: u8,
minute: u8,
second: u8,
frame: u8
) -> Result<Timecode<T>, &'static str> where
T: FrameRate, [src]
hour: u8,
minute: u8,
second: u8,
frame: u8
) -> Result<Timecode<T>, &'static str> where
T: FrameRate,
Returns a timecode with the given hour/minute/second/frame fields.
Example
use video_timecode::*; let timecode = match Timecode::<FrameRate24>::new(10, 0, 0, 0) { Ok(tc) => tc, _ => panic!() }; assert_eq!(timecode.frame_number, 864000);
Trait Implementations
impl<FrameRate: Debug> Debug for Timecode<FrameRate>[src]
impl<FrameRate: PartialEq> PartialEq for Timecode<FrameRate>[src]
fn eq(&self, __arg_0: &Timecode<FrameRate>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Timecode<FrameRate>) -> bool[src]
This method tests for !=.
impl<T> FromStr for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Err = ParseTimecodeError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>[src]
Parses a string s to return a value of this type. Read more
impl<T> From<usize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<usize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: usize) -> Self[src]
Performs the + operation.
impl<T> AddAssign<usize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: usize)[src]
Performs the += operation.
impl<T> From<u8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<u8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: u8) -> Self[src]
Performs the + operation.
impl<T> AddAssign<u8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: u8)[src]
Performs the += operation.
impl<T> From<u16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<u16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: u16) -> Self[src]
Performs the + operation.
impl<T> AddAssign<u16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: u16)[src]
Performs the += operation.
impl<T> From<u32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<u32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: u32) -> Self[src]
Performs the + operation.
impl<T> AddAssign<u32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: u32)[src]
Performs the += operation.
impl<T> From<u64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<u64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: u64) -> Self[src]
Performs the + operation.
impl<T> AddAssign<u64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: u64)[src]
Performs the += operation.
impl<T> From<isize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<isize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: isize) -> Self[src]
Performs the + operation.
impl<T> AddAssign<isize> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: isize)[src]
Performs the += operation.
impl<T> From<i8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<i8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: i8) -> Self[src]
Performs the + operation.
impl<T> AddAssign<i8> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: i8)[src]
Performs the += operation.
impl<T> From<i16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<i16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: i16) -> Self[src]
Performs the + operation.
impl<T> AddAssign<i16> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: i16)[src]
Performs the += operation.
impl<T> From<i32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<i32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: i32) -> Self[src]
Performs the + operation.
impl<T> AddAssign<i32> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: i32)[src]
Performs the += operation.
impl<T> From<i64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
impl<T> Add<i64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: i64) -> Self[src]
Performs the + operation.
impl<T> AddAssign<i64> for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
fn add_assign(&mut self, other: i64)[src]
Performs the += operation.
impl<T> Add for Timecode<T> where
T: FrameRate, [src]
T: FrameRate,
Adding timecodes of different framerates together is not supported.
Since adding Timecodes of different frame rates together normally does not make any sense, it is better that the programmer has to mark this, by explicitly adding the number of frames.
Example
use video_timecode::*; let tc1 = Timecode::<FrameRate2997>::new(0, 0, 0, 0).unwrap(); let tc2 = Timecode::<FrameRate24>::new(0, 0, 10, 0).unwrap(); let tc3 = tc1 + tc2.frame_number; assert_eq!(tc3, Timecode::<FrameRate2997>::new(0, 0, 8, 0).unwrap());