This repository was archived by the owner on Nov 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ impl File {
341
341
pub fn read_async < F > ( & mut self ,
342
342
io_priority : types:: gint ,
343
343
cancellable : Option < & mut Cancellable > ,
344
- callback : F )
344
+ callback : Box < F > )
345
345
where F : FnOnce ( & mut gobject:: Object , & mut AsyncResult ) + Send
346
346
{
347
347
unsafe {
Original file line number Diff line number Diff line change @@ -38,10 +38,10 @@ pub struct AsyncCallback<Args, Ret> {
38
38
39
39
impl < Args , Ret > AsyncCallback < Args , Ret > {
40
40
41
- pub fn new < F > ( func : F ) -> AsyncCallback < Args , Ret >
41
+ pub fn new < F > ( func : Box < F > ) -> AsyncCallback < Args , Ret >
42
42
where F : FnOnce < Args , Ret > + Send
43
43
{
44
- AsyncCallback { closure : box func }
44
+ AsyncCallback { closure : func }
45
45
}
46
46
47
47
pub fn invoke ( self , args : Args ) -> Ret {
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ fn async() {
72
72
run_on_mainloop ( |mut mainloop| {
73
73
let mut f = File :: new_for_path ( "/dev/null" ) ;
74
74
f. read_async ( 0 , None ,
75
- move |: obj, res| {
75
+ box move |obj, res| {
76
76
let f: & mut File = object:: cast_mut ( obj) ;
77
77
match f. read_finish ( res) {
78
78
Ok ( _) => { }
@@ -88,7 +88,7 @@ fn error_to_domain() {
88
88
run_on_mainloop ( |mut mainloop| {
89
89
let mut f = File :: new_for_path ( "./does-not-exist" ) ;
90
90
f. read_async ( 0 , None ,
91
- move |: obj, res| {
91
+ box move |obj, res| {
92
92
let f: & mut File = object:: cast_mut ( obj) ;
93
93
match f. read_finish ( res) {
94
94
Ok ( _) => { unreachable ! ( ) }
@@ -114,7 +114,7 @@ fn error_match_partial_eq() {
114
114
run_on_mainloop ( |mut mainloop| {
115
115
let mut f = File :: new_for_path ( "./does-not-exist" ) ;
116
116
f. read_async ( 0 , None ,
117
- move |: obj, res| {
117
+ box move |obj, res| {
118
118
let f: & mut File = object:: cast_mut ( obj) ;
119
119
match f. read_finish ( res) {
120
120
Ok ( _) => { unreachable ! ( ) }
You can’t perform that action at this time.
0 commit comments