Struct elma::Time [−][src]
pub struct Time(pub i32);
Wrapper for time in hundredths. Supports add/sub ops.
Examples
let time_x = Time(100); // 1 second let time_y = Time::from("00:00,01"); // 1 hundredth assert_eq!(Time::from("0..,0:099"), time_x - time_y); // from string impl allows somewhat malformed input assert_eq!("01:20,00", Time(8000).to_string()); // .to_string() pretty prints in 00:00,00 format
Methods
impl Time
[src]
impl Time
pub fn to_parts(&self) -> (bool, i32, i32, i32, i32)
[src]
pub fn to_parts(&self) -> (bool, i32, i32, i32, i32)
Returns a tuple with negative?
, hours
, mins
, secs
, hundredths
.
pub fn from(s: &str) -> Self
[src]
pub fn from(s: &str) -> Self
Methods from Deref<Target = i32>
Trait Implementations
impl Debug for Time
[src]
impl Debug for Time
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Time
[src]
impl Default for Time
impl Copy for Time
[src]
impl Copy for Time
impl Clone for Time
[src]
impl Clone for Time
fn clone(&self) -> Time
[src]
fn clone(&self) -> Time
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for Time
[src]
impl Eq for Time
impl PartialEq for Time
[src]
impl PartialEq for Time
fn eq(&self, other: &Time) -> bool
[src]
fn eq(&self, other: &Time) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Time) -> bool
[src]
fn ne(&self, other: &Time) -> bool
This method tests for !=
.
impl Ord for Time
[src]
impl Ord for Time
fn cmp(&self, other: &Time) -> Ordering
[src]
fn cmp(&self, other: &Time) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Time
[src]
impl PartialOrd for Time
fn partial_cmp(&self, other: &Time) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Time) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Time) -> bool
[src]
fn lt(&self, other: &Time) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Time) -> bool
[src]
fn le(&self, other: &Time) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Time) -> bool
[src]
fn gt(&self, other: &Time) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Time) -> bool
[src]
fn ge(&self, other: &Time) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl From<i32> for Time
[src]
impl From<i32> for Time
impl Add for Time
[src]
impl Add for Time
type Output = Time
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
fn add(self, other: Self) -> Self
Performs the +
operation.
impl Sub for Time
[src]
impl Sub for Time
type Output = Time
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
Performs the -
operation.
impl From<Time> for i32
[src]
impl From<Time> for i32
impl Deref for Time
[src]
impl Deref for Time
type Target = i32
The resulting type after dereferencing.
fn deref(&self) -> &i32
[src]
fn deref(&self) -> &i32
Dereferences the value.
impl Display for Time
[src]
impl Display for Time