Struct ros_message::Time
source · pub struct Time {
pub sec: u32,
pub nsec: u32,
}
Expand description
ROS representation of time, with nanosecond precision
Fields§
§sec: u32
Number of seconds.
nsec: u32
Number of nanoseconds inside the current second.
Implementations§
source§impl Time
impl Time
sourcepub fn from_nanos(t: i64) -> Time
pub fn from_nanos(t: i64) -> Time
Creates a time of the given number of nanoseconds.
§Examples
assert_eq!(Time::from_nanos(0), Time { sec: 0, nsec: 0 });
assert_eq!(Time::from_nanos(12_000_000_123), Time { sec: 12, nsec: 123 });
sourcepub fn from_seconds(sec: u32) -> Time
pub fn from_seconds(sec: u32) -> Time
Creates a time of the given number of seconds.
§Examples
assert_eq!(Time::from_seconds(0), Time { sec: 0, nsec: 0 });
assert_eq!(Time::from_seconds(12), Time { sec: 12, nsec: 0 });
Trait Implementations§
source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
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 From<SystemTime> for Time
impl From<SystemTime> for Time
source§fn from(other: SystemTime) -> Self
fn from(other: SystemTime) -> Self
Converts to this type from the input type.
source§impl From<Time> for SystemTime
impl From<Time> for SystemTime
source§impl Ord for Time
impl Ord for Time
source§impl PartialOrd for Time
impl PartialOrd for Time
impl Copy for Time
impl Eq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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