File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,10 @@ impl CodeGen {
354354 writeln ! ( out, " std::mem::forget(self);" ) ?;
355355 writeln ! ( out, " raw" ) ?;
356356 writeln ! ( out, " }}" ) ?;
357+ writeln ! ( out) ?;
358+ writeln ! ( out, " unsafe fn as_raw(&self) -> *const u8 {{" ) ?;
359+ writeln ! ( out, " self.raw" ) ?;
360+ writeln ! ( out, " }}" ) ?;
357361 writeln ! ( out, "}}" ) ?;
358362
359363 self . emit_debug_impl ( out, reply_rs_typ, & reply. fields ) ?;
Original file line number Diff line number Diff line change @@ -301,6 +301,13 @@ pub trait Reply {
301301 /// The returned pointer must be freed with [`libc::free`] to avoid any memory leak, or be used
302302 /// to build another reply.
303303 unsafe fn into_raw ( self ) -> * const u8 ;
304+
305+ /// Get the raw pointer of the XCB reply.
306+ ///
307+ /// # Safety
308+ /// The returned pointer must NOT be freed. Passing this pointer to [`libc::free`] will result in a double free
309+ /// when the reply is dropped.
310+ unsafe fn as_raw ( & self ) -> * const u8 ;
304311}
305312
306313/// General trait for cookies returned by requests.
You can’t perform that action at this time.
0 commit comments