@@ -11,7 +11,7 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
11
11
fn read_line < P : IsA < Cancellable > > (
12
12
& self ,
13
13
cancellable : Option < & P > ,
14
- ) -> Result < glib:: collections:: Slice < u8 > , glib:: Error > {
14
+ ) -> Result < Option < glib:: collections:: Slice < u8 > > , glib:: Error > {
15
15
unsafe {
16
16
let mut length = mem:: MaybeUninit :: uninit ( ) ;
17
17
let mut error = ptr:: null_mut ( ) ;
@@ -21,9 +21,13 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
21
21
cancellable. map ( |p| p. as_ref ( ) ) . to_glib_none ( ) . 0 ,
22
22
& mut error,
23
23
) ;
24
- let length = length. assume_init ( ) ;
25
24
if error. is_null ( ) {
26
- Ok ( FromGlibContainer :: from_glib_full_num ( ret, length) )
25
+ if ret. is_null ( ) {
26
+ Ok ( None )
27
+ } else {
28
+ let length = length. assume_init ( ) ;
29
+ Ok ( Some ( FromGlibContainer :: from_glib_full_num ( ret, length) ) )
30
+ }
27
31
} else {
28
32
Err ( from_glib_full ( error) )
29
33
}
@@ -33,7 +37,7 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
33
37
#[ doc( alias = "g_data_input_stream_read_line_async" ) ]
34
38
fn read_line_async <
35
39
P : IsA < Cancellable > ,
36
- Q : FnOnce ( Result < glib:: collections:: Slice < u8 > , glib:: Error > ) + ' static ,
40
+ Q : FnOnce ( Result < Option < glib:: collections:: Slice < u8 > > , glib:: Error > ) + ' static ,
37
41
> (
38
42
& self ,
39
43
io_priority : glib:: Priority ,
@@ -53,7 +57,7 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
53
57
let user_data: Box_ < glib:: thread_guard:: ThreadGuard < Q > > =
54
58
Box_ :: new ( glib:: thread_guard:: ThreadGuard :: new ( callback) ) ;
55
59
unsafe extern "C" fn read_line_async_trampoline <
56
- Q : FnOnce ( Result < glib:: collections:: Slice < u8 > , glib:: Error > ) + ' static ,
60
+ Q : FnOnce ( Result < Option < glib:: collections:: Slice < u8 > > , glib:: Error > ) + ' static ,
57
61
> (
58
62
_source_object : * mut glib:: gobject_ffi:: GObject ,
59
63
res : * mut ffi:: GAsyncResult ,
@@ -67,9 +71,13 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
67
71
length. as_mut_ptr ( ) ,
68
72
& mut error,
69
73
) ;
70
- let length = length. assume_init ( ) ;
71
74
let result = if error. is_null ( ) {
72
- Ok ( FromGlibContainer :: from_glib_full_num ( ret, length) )
75
+ if ret. is_null ( ) {
76
+ Ok ( None )
77
+ } else {
78
+ let length = length. assume_init ( ) ;
79
+ Ok ( Some ( FromGlibContainer :: from_glib_full_num ( ret, length) ) )
80
+ }
73
81
} else {
74
82
Err ( from_glib_full ( error) )
75
83
} ;
@@ -95,8 +103,9 @@ pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
95
103
io_priority : glib:: Priority ,
96
104
) -> Pin <
97
105
Box_ <
98
- dyn std:: future:: Future < Output = Result < glib:: collections:: Slice < u8 > , glib:: Error > >
99
- + ' static ,
106
+ dyn std:: future:: Future <
107
+ Output = Result < Option < glib:: collections:: Slice < u8 > > , glib:: Error > ,
108
+ > + ' static ,
100
109
> ,
101
110
> {
102
111
Box_ :: pin ( crate :: GioFuture :: new (
0 commit comments