Skip to content

Commit 0c02f29

Browse files
committed
feat(core): implement Zeroable for r3_core::time::{Time,Duration}
1 parent 77cbee0 commit 0c02f29

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/r3_core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Added
1111

1212
- `r3_core::utils::{Zeroable,ZeroableInOption}` (re-exported from `bytemuck ^1`)
13+
- Implement `Zeroable` on `r3_core::time::{Duration, Time}`
1314

1415
## [0.1.4] - 2022-11-16
1516

src/r3_core/src/time/duration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use core::{fmt, ops};
22

3-
use crate::utils::{Init, ZeroInit};
3+
use crate::utils::{Init, ZeroInit, Zeroable};
44

55
/// Represents a signed time span used by the API surface of R3-OS.
66
///
77
/// `Duration` is backed by `i32` and can represent the range
88
/// [-35′47.483648″, +35′47.483647″] with microsecond precision.
9-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
9+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Zeroable)]
1010
#[repr(transparent)]
1111
pub struct Duration {
1212
micros: i32,

src/r3_core/src/time/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::{fmt, ops};
22

33
use crate::{
44
time::Duration,
5-
utils::{Init, ZeroInit},
5+
utils::{Init, ZeroInit, Zeroable},
66
};
77

88
/// Represents a timestamp used by the API surface of R3-OS.
@@ -13,7 +13,7 @@ use crate::{
1313
///
1414
/// `Time` is backed by `u64` and can represent up to 213,503,982 days with
1515
/// microsecond precision.
16-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
16+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Zeroable)]
1717
#[repr(transparent)]
1818
pub struct Time {
1919
micros: u64,

0 commit comments

Comments
 (0)