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 3de0ce7 commit 5b1845eCopy full SHA for 5b1845e
src/base.rs
@@ -88,6 +88,19 @@ pub struct StructPtr<'a, T: 'a> {
88
phantom: PhantomData<&'a T>
89
}
90
91
+impl<'a, T: 'a> Copy for StructPtr<'a, T> {}
92
+impl<'a, T: 'a> Clone for StructPtr<'a, T> {
93
+ fn clone(&self) -> Self {
94
+ *self
95
+ }
96
+}
97
+
98
+impl<'a, T: 'a> StructPtr<'a, T> {
99
+ pub unsafe fn borrow(self) -> &'a T {
100
+ &*self.ptr
101
102
103
104
105
/// `Event` wraps a pointer to `xcb_*_event_t`
106
/// this pointer will be freed when the `Event` goes out of scope
@@ -229,6 +242,11 @@ impl<T> Drop for Reply<T> {
229
242
230
243
231
244
245
+impl<T> Reply<T> {
246
+ pub unsafe fn borrow<'a>(&'a self) -> &'a T {
247
248
249
232
250
#[cfg(feature="thread")]
233
251
unsafe impl<T> Send for Reply<T> {}
234
252
0 commit comments