Skip to content

Commit

Permalink
Derive Clone for OsRng
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Apr 10, 2018
1 parent 628a952 commit b3687ea
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use rand_core::{RngCore, Error, impls};
/// [`EntropyRng`]: struct.EntropyRng.html

#[allow(unused)] // not used by all targets
#[derive(Clone)]
pub struct OsRng(imp::OsRng);

impl fmt::Debug for OsRng {
Expand Down Expand Up @@ -149,7 +150,7 @@ mod imp {
use std::io::Read;
use std::sync::{Once, Mutex, ONCE_INIT};

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng(OsRngMethod);

#[derive(Debug)]
Expand Down Expand Up @@ -373,7 +374,7 @@ mod imp {

use {Error, ErrorKind};

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand Down Expand Up @@ -408,7 +409,7 @@ mod imp {
use std::io;
use self::libc::{c_int, size_t};

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

enum SecRandom {}
Expand Down Expand Up @@ -452,7 +453,7 @@ mod imp {
use std::ptr;
use std::io;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand Down Expand Up @@ -490,7 +491,7 @@ mod imp {

use std::io;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand Down Expand Up @@ -524,7 +525,7 @@ mod imp {
use std::io::ErrorKind::*;
use std::sync::{Once, Mutex, ONCE_INIT};

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng();

// TODO: remove outer Option when `Mutex::new(None)` is a constant expression
Expand Down Expand Up @@ -584,7 +585,7 @@ mod imp {

use std::io;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand Down Expand Up @@ -624,7 +625,7 @@ mod imp {
use self::winapi::um::ntsecapi::RtlGenRandom;
use self::winapi::um::winnt::PVOID;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand Down Expand Up @@ -657,7 +658,7 @@ mod imp {
mod imp {
use {Error, ErrorKind};

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng;

impl OsRng {
Expand All @@ -682,13 +683,13 @@ mod imp {
use stdweb::web::error::Error as WebError;
use {Error, ErrorKind};

#[derive(Debug)]
#[derive(Clone, Debug)]
enum OsRngInner {
Browser,
Node
}

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct OsRng(OsRngInner);

impl OsRng {
Expand Down

0 comments on commit b3687ea

Please sign in to comment.