Struct ros_message::Duration
source · pub struct Duration {
pub sec: i32,
pub nsec: i32,
}
Expand description
ROS representation of duration, with nanosecond precision
Fields§
§sec: i32
Number of seconds. Negative for negative durations.
nsec: i32
Number of nanoseconds inside the current second. Negative for negative durations.
Implementations§
source§impl Duration
impl Duration
sourcepub fn new() -> Duration
pub fn new() -> Duration
Creates a new duration of zero value.
§Examples
assert_eq!(Duration::new(), Duration { sec: 0, nsec: 0 });
sourcepub fn from_nanos(t: i64) -> Duration
pub fn from_nanos(t: i64) -> Duration
Creates a duration of the given number of nanoseconds.
§Examples
assert_eq!(Duration::from_nanos(0), Duration { sec: 0, nsec: 0 });
assert_eq!(Duration::from_nanos(12_000_000_123), Duration { sec: 12, nsec: 123 });
assert_eq!(Duration::from_nanos(-12_000_000_123), Duration { sec: -12, nsec: -123 });
sourcepub fn from_seconds(sec: i32) -> Duration
pub fn from_seconds(sec: i32) -> Duration
Creates a duration of the given number of seconds.
§Examples
assert_eq!(Duration::from_seconds(0), Duration { sec: 0, nsec: 0 });
assert_eq!(Duration::from_seconds(12), Duration { sec: 12, nsec: 0 });
assert_eq!(Duration::from_seconds(-12), Duration { sec: -12, nsec: 0 });
Trait Implementations§
source§impl<'de> Deserialize<'de> for Duration
impl<'de> Deserialize<'de> for Duration
source§fn 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
source§impl Ord for Duration
impl Ord for Duration
source§impl PartialOrd for Duration
impl PartialOrd for Duration
impl Copy for Duration
impl Eq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more