pub struct Time(f64);
Expand description
In seconds since midnight. Can’t be negative.
Tuple Fields
0: f64
Implementations
sourceimpl Time
impl Time
pub const START_OF_DAY: Time = Time(0.0)
fn seconds_since_midnight(value: f64) -> Time
pub fn ampm_tostring(self) -> String
pub fn as_filename(self) -> String
pub fn parse(string: &str) -> Result<Time>
pub fn percent_of(self, p: f64) -> Time
pub fn to_percent(self, other: Time) -> f64
sourcepub fn inner_seconds(self) -> f64
pub fn inner_seconds(self) -> f64
For RNG range generation. Don’t abuse.
pub fn clamped_sub(self, dt: Duration) -> Time
pub fn round_seconds(self, s: f64) -> Time
Trait Implementations
sourceimpl AddAssign<Duration> for Time
impl AddAssign<Duration> for Time
sourcefn add_assign(&mut self, other: Duration)
fn add_assign(&mut self, other: Duration)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for Time
impl Ord for Time
sourceimpl PartialOrd<Time> for Time
impl PartialOrd<Time> for Time
sourcefn partial_cmp(&self, other: &Time) -> Option<Ordering>
fn partial_cmp(&self, other: &Time) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more