[][src]Struct cue_sheet::parser::Time

pub struct Time { /* fields omitted */ }

Time representation of the format mm:ss:ff.

Where mm = minutes, ss = seconds, ff = frames/sectors. There are 75 frames per second, 60 seconds per minute.

Methods

impl Time[src]

pub fn new(minutes: i32, seconds: i8, frames: i8) -> Time[src]

Create a new instance with the specified components.

pub fn to_string_2(&self) -> String[src]

Format as `mm:ss' dropping truncating the remainding frames.

pub fn minutes(&self) -> i32[src]

Returns the "minutes" component of this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.minutes(), 1);

pub fn seconds(&self) -> i8[src]

Returns the "seconds" component of this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.seconds(), 2);

pub fn frames(&self) -> i8[src]

Returns the "frames/sectors" component of this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.frames(), 3);

pub fn total_minutes(&self) -> f64[src]

Returns the total number of minutes represented by this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.total_minutes(), 1.034);

let time = Time::new(2, 30, 0);
assert_eq!(time.total_minutes(), 2.5);

pub fn total_seconds(&self) -> f64[src]

Returns the total number of seconds represented by this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.total_seconds(), 62.04);

let time = Time::new(2, 30, 0);
assert_eq!(time.total_seconds(), 150.);

pub fn total_frames(&self) -> i64[src]

Returns the total number of frames/sectors represented by this instance.

use cue_sheet::parser::Time;

let time = Time::new(1, 2, 3);
assert_eq!(time.total_frames(), 4653);

let time = Time::new(2, 30, 5);
assert_eq!(time.total_frames(), 11255);

pub fn from_frames(from: i64) -> Time[src]

Create an instance for the specified number of frames/sectors.

use cue_sheet::parser::Time;

let time = Time::from_frames(200);
assert_eq!(time, Time::new(0, 2, 50));

Trait Implementations

impl Clone for Time[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Time> for Time[src]

impl PartialOrd<Time> for Time[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Time[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more

impl Eq for Time[src]

impl Hash for Time[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Sub<Time> for Time[src]

type Output = Time

The resulting type after applying the - operator.

impl Debug for Time[src]

impl Display for Time[src]

impl FromStr for Time[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Time

impl Sync for Time

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]