File tree Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,10 @@ status = "generate"
453
453
# Take by value and return self
454
454
manual = true
455
455
[[object .function ]]
456
+ pattern = " get_fd"
457
+ # Use BorrowedFd
458
+ manual = true
459
+ [[object .function ]]
456
460
name = " build"
457
461
manual = true # Can't be auto-generated
458
462
[[object .property ]]
Original file line number Diff line number Diff line change @@ -47,12 +47,6 @@ impl DmabufTextureBuilder {
47
47
}
48
48
}
49
49
50
- #[ doc( alias = "gdk_dmabuf_texture_builder_get_fd" ) ]
51
- #[ doc( alias = "get_fd" ) ]
52
- pub fn fd ( & self , plane : u32 ) -> i32 {
53
- unsafe { ffi:: gdk_dmabuf_texture_builder_get_fd ( self . to_glib_none ( ) . 0 , plane) }
54
- }
55
-
56
50
#[ doc( alias = "gdk_dmabuf_texture_builder_get_fourcc" ) ]
57
51
#[ doc( alias = "get_fourcc" ) ]
58
52
pub fn fourcc ( & self ) -> u32 {
Original file line number Diff line number Diff line change @@ -35,15 +35,34 @@ impl DmabufTextureBuilder {
35
35
self
36
36
}
37
37
38
+ // rustdoc-stripper-ignore-next
39
+ /// # Safety
40
+ ///
41
+ /// The caller must ensure that `fd` says valid for at least as long as the texture, e.g. by
42
+ /// using `build_with_release_func()` to get notified when `fd` is not used anymore.
38
43
#[ doc( alias = "gdk_dmabuf_texture_builder_set_fd" ) ]
39
- pub fn set_fd ( self , plane : u32 , fd : i32 ) -> Self {
44
+ pub unsafe fn set_fd ( self , plane : u32 , fd : std :: os :: fd :: RawFd ) -> Self {
40
45
unsafe {
41
46
ffi:: gdk_dmabuf_texture_builder_set_fd ( self . to_glib_none ( ) . 0 , plane, fd) ;
42
47
}
43
48
44
49
self
45
50
}
46
51
52
+ #[ doc( alias = "gdk_dmabuf_texture_builder_get_fd" ) ]
53
+ #[ doc( alias = "get_fd" ) ]
54
+ pub fn fd ( & self , plane : u32 ) -> Option < std:: os:: fd:: BorrowedFd < ' _ > > {
55
+ unsafe {
56
+ let fd = ffi:: gdk_dmabuf_texture_builder_get_fd ( self . to_glib_none ( ) . 0 , plane) ;
57
+
58
+ if fd == -1 {
59
+ None
60
+ } else {
61
+ Some ( std:: os:: fd:: BorrowedFd :: borrow_raw ( fd) )
62
+ }
63
+ }
64
+ }
65
+
47
66
#[ doc( alias = "gdk_dmabuf_texture_builder_set_fourcc" ) ]
48
67
#[ doc( alias = "fourcc" ) ]
49
68
pub fn set_fourcc ( self , fourcc : u32 ) -> Self {
You can’t perform that action at this time.
0 commit comments