We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
OsRng
1 parent 556d971 commit c3778faCopy full SHA for c3778fa
src/libstd/rand/os.rs
@@ -187,7 +187,10 @@ mod imp {
187
/// - iOS: calls SecRandomCopyBytes as /dev/(u)random is sandboxed
188
/// This does not block.
189
#[allow(missing_copy_implementations)]
190
- pub struct OsRng;
+ pub struct OsRng {
191
+ // dummy field to ensure that this struct cannot be constructed outside of this module
192
+ _dummy: (),
193
+ }
194
195
#[repr(C)]
196
struct SecRandom;
@@ -204,7 +207,7 @@ mod imp {
204
207
impl OsRng {
205
208
/// Create a new `OsRng`.
206
209
pub fn new() -> IoResult<OsRng> {
- Ok(OsRng)
210
+ Ok(OsRng { _dummy: () })
211
}
212
213
0 commit comments