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.
1 parent a91aa00 commit 83c2f2eCopy full SHA for 83c2f2e
src/lib.rs
@@ -34,7 +34,7 @@ use core::ptr;
34
/// take and return copies of the value.
35
///
36
/// The size of this struct is the same as the size of the contained type.
37
-#[derive(Debug, Clone)]
+#[derive(Debug)]
38
pub struct Volatile<T: Copy>(T);
39
40
impl<T: Copy> Volatile<T> {
@@ -140,6 +140,12 @@ impl<T: Copy> Volatile<T> {
140
}
141
142
143
+impl<T: Copy> Clone for Volatile<T> {
144
+ fn clone(&self) -> Self {
145
+ Volatile(self.read())
146
+ }
147
+}
148
+
149
/// A volatile wrapper which only allows read operations.
150
151
/// The size of this struct is the same as the contained type.
0 commit comments