File tree 9 files changed +30
-24
lines changed
9 files changed +30
-24
lines changed Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementation for FreeBSD and NetBSD
10
- use crate :: util_libc:: sys_fill_exact;
11
- use crate :: Error ;
10
+ use crate :: { util_libc:: sys_fill_exact, Error } ;
12
11
use core:: ptr;
13
12
14
13
fn kern_arnd ( buf : & mut [ u8 ] ) -> libc:: ssize_t {
Original file line number Diff line number Diff line change 5
5
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6
6
// option. This file may not be copied, modified, or distributed
7
7
// except according to those terms.
8
- use core:: fmt;
9
- use core:: num:: NonZeroU32 ;
8
+ use core:: { fmt, num:: NonZeroU32 } ;
10
9
11
10
/// A small and `no_std` compatible error type.
12
11
///
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementation for Linux / Android
10
- use crate :: util:: LazyBool ;
11
- use crate :: util_libc:: { last_os_error, sys_fill_exact} ;
12
- use crate :: { use_file, Error } ;
10
+ use crate :: {
11
+ util:: LazyBool ,
12
+ util_libc:: { last_os_error, sys_fill_exact} ,
13
+ { use_file, Error } ,
14
+ } ;
13
15
14
16
pub fn getrandom_inner ( dest : & mut [ u8 ] ) -> Result < ( ) , Error > {
15
17
static HAS_GETRANDOM : LazyBool = LazyBool :: new ( ) ;
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementation for macOS
10
- use crate :: util_libc:: { last_os_error, Weak } ;
11
- use crate :: { use_file, Error } ;
10
+ use crate :: {
11
+ use_file,
12
+ util_libc:: { last_os_error, Weak } ,
13
+ Error ,
14
+ } ;
12
15
use core:: mem;
13
16
14
17
type GetEntropyFn = unsafe extern "C" fn ( * mut u8 , libc:: size_t ) -> libc:: c_int ;
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementation for OpenBSD
10
- use crate :: util_libc:: last_os_error;
11
- use crate :: Error ;
10
+ use crate :: { util_libc:: last_os_error, Error } ;
12
11
13
12
pub fn getrandom_inner ( dest : & mut [ u8 ] ) -> Result < ( ) , Error > {
14
13
for chunk in dest. chunks_mut ( 256 ) {
Original file line number Diff line number Diff line change 17
17
//! To make sure we can compile on both Solaris and its derivatives, as well as
18
18
//! function, we check for the existence of getrandom(2) in libc by calling
19
19
//! libc::dlsym.
20
- use crate :: util_libc:: { sys_fill_exact, Weak } ;
21
- use crate :: { use_file, Error } ;
20
+ use crate :: {
21
+ use_file,
22
+ util_libc:: { sys_fill_exact, Weak } ,
23
+ Error ,
24
+ } ;
22
25
use core:: mem;
23
26
24
27
#[ cfg( target_os = "illumos" ) ]
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementations that just need to read from a file
10
- use crate :: util:: LazyUsize ;
11
- use crate :: util_libc:: { open_readonly, sys_fill_exact} ;
12
- use crate :: Error ;
13
- use core:: cell:: UnsafeCell ;
14
- use core:: sync:: atomic:: { AtomicUsize , Ordering :: Relaxed } ;
10
+ use crate :: {
11
+ util:: LazyUsize ,
12
+ util_libc:: { open_readonly, sys_fill_exact} ,
13
+ Error ,
14
+ } ;
15
+ use core:: {
16
+ cell:: UnsafeCell ,
17
+ sync:: atomic:: { AtomicUsize , Ordering :: Relaxed } ,
18
+ } ;
15
19
16
20
#[ cfg( target_os = "redox" ) ]
17
21
const FILE_PATH : & str = "rand:\0 " ;
Original file line number Diff line number Diff line change 6
6
// option. This file may not be copied, modified, or distributed
7
7
// except according to those terms.
8
8
#![ allow( dead_code) ]
9
- use crate :: util:: LazyUsize ;
10
- use crate :: Error ;
11
- use core:: num:: NonZeroU32 ;
12
- use core:: ptr:: NonNull ;
9
+ use crate :: { util:: LazyUsize , Error } ;
10
+ use core:: { num:: NonZeroU32 , ptr:: NonNull } ;
13
11
14
12
cfg_if ! {
15
13
if #[ cfg( any( target_os = "netbsd" , target_os = "openbsd" , target_os = "android" ) ) ] {
Original file line number Diff line number Diff line change 7
7
// except according to those terms.
8
8
9
9
//! Implementation for VxWorks
10
- use crate :: util_libc:: last_os_error;
11
- use crate :: Error ;
10
+ use crate :: { util_libc:: last_os_error, Error } ;
12
11
use core:: sync:: atomic:: { AtomicBool , Ordering :: Relaxed } ;
13
12
14
13
pub fn getrandom_inner ( dest : & mut [ u8 ] ) -> Result < ( ) , Error > {
You can’t perform that action at this time.
0 commit comments