We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
DropGuard
wait_until_rng_ready
1 parent 062cc24 commit ee6e835Copy full SHA for ee6e835
src/use_file.rs
@@ -134,6 +134,14 @@ fn get_rng_fd() -> Result<libc::c_int, Error> {
134
// libsodium uses `libc::poll` similarly to this.
135
#[cfg(any(target_os = "android", target_os = "linux"))]
136
fn wait_until_rng_ready() -> Result<(), Error> {
137
+ struct DropGuard<F: FnMut()>(F);
138
+
139
+ impl<F: FnMut()> Drop for DropGuard<F> {
140
+ fn drop(&mut self) {
141
+ self.0()
142
+ }
143
144
145
let fd = open_readonly(b"/dev/random\0")?;
146
let mut pfd = libc::pollfd {
147
fd,
@@ -158,11 +166,3 @@ fn wait_until_rng_ready() -> Result<(), Error> {
158
166
}
159
167
160
168
161
-
162
-struct DropGuard<F: FnMut()>(F);
163
164
-impl<F: FnMut()> Drop for DropGuard<F> {
165
- fn drop(&mut self) {
- self.0()
- }
-}
0 commit comments