File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ pub struct Id(pub [u8; RAW_LEN]);
17
17
18
18
impl Id {
19
19
/// Create an Id from a bytes slice.
20
+ ///
21
+ /// # Errors
22
+ ///
23
+ /// Will return `Err` if the length of `bytes` is invalid.
20
24
pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < Self , ParseIdError > {
21
25
if bytes. len ( ) != RAW_LEN {
22
26
return Err ( ParseIdError :: InvalidLength ( bytes. len ( ) ) ) ;
@@ -65,6 +69,7 @@ impl Id {
65
69
}
66
70
67
71
/// Returns true if this is a "zero" ID
72
+ #[ must_use]
68
73
pub fn is_zero ( & self ) -> bool {
69
74
self . 0 == ZERO . 0
70
75
}
Original file line number Diff line number Diff line change 1
1
use rand:: RngCore ;
2
- #[ cfg( any ( target_os = "macos" ) ) ]
2
+ #[ cfg( target_os = "macos" ) ]
3
3
use sysctl:: { Sysctl , SysctlError } ;
4
4
5
5
// https://github.com/rs/xid/blob/efa678f304ab65d6d57eedcb086798381ae22206/id.go#L117
You can’t perform that action at this time.
0 commit comments