File tree Expand file tree Collapse file tree 3 files changed +22
-18
lines changed Expand file tree Collapse file tree 3 files changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -891,6 +891,11 @@ manual_traits = ["FileEnumeratorExtManual"]
891891 name = " iterate"
892892 # better with rust iterators
893893 ignore = true
894+ [[object .function ]]
895+ name = " close"
896+ # Return value does not indicate success or error: despite the documentation, this function could return TRUE and an error in same time.
897+ # see https://gitlab.gnome.org/GNOME/glib/-/blob/dc6f9447cd2a01012731422afed6facff1eea81a/gio/gfileenumerator.c#L290-297
898+ ignore = true
894899
895900[[object ]]
896901name = " Gio.FileInfo"
Original file line number Diff line number Diff line change @@ -20,24 +20,6 @@ impl FileEnumerator {
2020}
2121
2222pub trait FileEnumeratorExt : IsA < FileEnumerator > + ' static {
23- #[ doc( alias = "g_file_enumerator_close" ) ]
24- fn close ( & self , cancellable : Option < & impl IsA < Cancellable > > ) -> Result < ( ) , glib:: Error > {
25- unsafe {
26- let mut error = std:: ptr:: null_mut ( ) ;
27- let is_ok = ffi:: g_file_enumerator_close (
28- self . as_ref ( ) . to_glib_none ( ) . 0 ,
29- cancellable. map ( |p| p. as_ref ( ) ) . to_glib_none ( ) . 0 ,
30- & mut error,
31- ) ;
32- debug_assert_eq ! ( is_ok == glib:: ffi:: GFALSE , !error. is_null( ) ) ;
33- if error. is_null ( ) {
34- Ok ( ( ) )
35- } else {
36- Err ( from_glib_full ( error) )
37- }
38- }
39- }
40-
4123 #[ doc( alias = "g_file_enumerator_close_async" ) ]
4224 fn close_async < P : FnOnce ( Result < ( ) , glib:: Error > ) + ' static > (
4325 & self ,
Original file line number Diff line number Diff line change 33use crate :: { prelude:: * , FileEnumerator , FileInfo } ;
44use futures_core:: future:: LocalBoxFuture ;
55use futures_util:: FutureExt ;
6+ use glib:: translate:: { from_glib, from_glib_full, ToGlibPtr } ;
67use std:: { iter:: FusedIterator , task:: Poll } ;
78
89impl Iterator for FileEnumerator {
@@ -30,6 +31,22 @@ pub trait FileEnumeratorExtManual: IsA<FileEnumerator> {
3031 priority,
3132 }
3233 }
34+
35+ #[ doc( alias = "g_file_enumerator_close" ) ]
36+ fn close (
37+ & self ,
38+ cancellable : Option < & impl IsA < crate :: Cancellable > > ,
39+ ) -> ( bool , Option < glib:: Error > ) {
40+ unsafe {
41+ let mut error = std:: ptr:: null_mut ( ) ;
42+ let ret = crate :: ffi:: g_file_enumerator_close (
43+ self . as_ref ( ) . to_glib_none ( ) . 0 ,
44+ cancellable. map ( |p| p. as_ref ( ) ) . to_glib_none ( ) . 0 ,
45+ & mut error,
46+ ) ;
47+ ( from_glib ( ret) , from_glib_full ( error) )
48+ }
49+ }
3350}
3451
3552impl < O : IsA < FileEnumerator > > FileEnumeratorExtManual for O { }
You can’t perform that action at this time.
0 commit comments