@@ -270,7 +270,7 @@ where F: FnMut() -> Continue + 'static {
270
270
/// process exits.
271
271
///
272
272
/// `func` will be called when `pid` exits
273
- pub fn child_watch_add < ' a , N : Into < Option < & ' a str > > , F > ( pid : Pid , func : F ) -> SourceId
273
+ pub fn child_watch_add < F > ( pid : Pid , func : F ) -> SourceId
274
274
where F : FnMut ( Pid , i32 ) + Send + ' static {
275
275
unsafe {
276
276
from_glib ( glib_ffi:: g_child_watch_add_full ( glib_ffi:: G_PRIORITY_DEFAULT , pid. 0 ,
@@ -288,7 +288,7 @@ where F: FnMut(Pid, i32) + Send + 'static {
288
288
///
289
289
/// This function panics if called from a different thread than the one that
290
290
/// owns the main context.
291
- pub fn child_watch_add_local < ' a , N : Into < Option < & ' a str > > , F > ( pid : Pid , func : F ) -> SourceId
291
+ pub fn child_watch_add_local < F > ( pid : Pid , func : F ) -> SourceId
292
292
where F : FnMut ( Pid , i32 ) + ' static {
293
293
unsafe {
294
294
assert ! ( MainContext :: default ( ) . is_owner( ) ) ;
@@ -427,14 +427,13 @@ pub const PRIORITY_LOW: Priority = Priority(glib_ffi::G_PRIORITY_LOW);
427
427
/// Adds a closure to be called by the main loop the return `Source` is attached to when it's idle.
428
428
///
429
429
/// `func` will be called repeatedly until it returns `Continue(false)`.
430
- pub fn idle_source_new < ' a , N : Into < Option < & ' a str > > , F > ( name : N , priority : Priority , func : F ) -> Source
430
+ pub fn idle_source_new < F > ( name : Option < & str > , priority : Priority , func : F ) -> Source
431
431
where F : FnMut ( ) -> Continue + Send + ' static {
432
432
unsafe {
433
433
let source = glib_ffi:: g_idle_source_new ( ) ;
434
434
glib_ffi:: g_source_set_callback ( source, Some ( trampoline :: < F > ) , into_raw ( func) , Some ( destroy_closure :: < F > ) ) ;
435
435
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
436
436
437
- let name = name. into ( ) ;
438
437
if let Some ( name) = name {
439
438
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
440
439
}
@@ -450,14 +449,13 @@ where F: FnMut() -> Continue + Send + 'static {
450
449
/// returns `Continue(false)`. Precise timing is not guaranteed, the timeout may
451
450
/// be delayed by other events. Prefer `timeout_add_seconds` when millisecond
452
451
/// precision is not necessary.
453
- pub fn timeout_source_new < ' a , N : Into < Option < & ' a str > > , F > ( interval : u32 , name : N , priority : Priority , func : F ) -> Source
452
+ pub fn timeout_source_new < F > ( interval : u32 , name : Option < & str > , priority : Priority , func : F ) -> Source
454
453
where F : FnMut ( ) -> Continue + Send + ' static {
455
454
unsafe {
456
455
let source = glib_ffi:: g_timeout_source_new ( interval) ;
457
456
glib_ffi:: g_source_set_callback ( source, Some ( trampoline :: < F > ) , into_raw ( func) , Some ( destroy_closure :: < F > ) ) ;
458
457
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
459
458
460
- let name = name. into ( ) ;
461
459
if let Some ( name) = name {
462
460
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
463
461
}
@@ -472,14 +470,13 @@ where F: FnMut() -> Continue + Send + 'static {
472
470
/// `func` will be called repeatedly every `interval` seconds until it
473
471
/// returns `Continue(false)`. Precise timing is not guaranteed, the timeout may
474
472
/// be delayed by other events.
475
- pub fn timeout_source_new_seconds < ' a , N : Into < Option < & ' a str > > , F > ( interval : u32 , name : N , priority : Priority , func : F ) -> Source
473
+ pub fn timeout_source_new_seconds < F > ( interval : u32 , name : Option < & str > , priority : Priority , func : F ) -> Source
476
474
where F : FnMut ( ) -> Continue + Send + ' static {
477
475
unsafe {
478
476
let source = glib_ffi:: g_timeout_source_new_seconds ( interval) ;
479
477
glib_ffi:: g_source_set_callback ( source, Some ( trampoline :: < F > ) , into_raw ( func) , Some ( destroy_closure :: < F > ) ) ;
480
478
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
481
479
482
- let name = name. into ( ) ;
483
480
if let Some ( name) = name {
484
481
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
485
482
}
@@ -492,14 +489,13 @@ where F: FnMut() -> Continue + Send + 'static {
492
489
/// process exits.
493
490
///
494
491
/// `func` will be called when `pid` exits
495
- pub fn child_watch_source_new < ' a , N : Into < Option < & ' a str > > , F > ( pid : Pid , name : N , priority : Priority , func : F ) -> Source
492
+ pub fn child_watch_source_new < F > ( pid : Pid , name : Option < & str > , priority : Priority , func : F ) -> Source
496
493
where F : FnMut ( Pid , i32 ) + Send + ' static {
497
494
unsafe {
498
495
let source = glib_ffi:: g_child_watch_source_new ( pid. 0 ) ;
499
496
glib_ffi:: g_source_set_callback ( source, Some ( transmute ( trampoline_child_watch :: < F > as usize ) ) , into_raw_child_watch ( func) , Some ( destroy_closure_child_watch :: < F > ) ) ;
500
497
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
501
498
502
- let name = name. into ( ) ;
503
499
if let Some ( name) = name {
504
500
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
505
501
}
@@ -514,14 +510,13 @@ where F: FnMut(Pid, i32) + Send + 'static {
514
510
///
515
511
/// `func` will be called repeatedly every time `signum` is raised until it
516
512
/// returns `Continue(false)`.
517
- pub fn unix_signal_source_new < ' a , N : Into < Option < & ' a str > > , F > ( signum : i32 , name : N , priority : Priority , func : F ) -> Source
513
+ pub fn unix_signal_source_new < F > ( signum : i32 , name : Option < & str > , priority : Priority , func : F ) -> Source
518
514
where F : FnMut ( ) -> Continue + Send + ' static {
519
515
unsafe {
520
516
let source = glib_ffi:: g_unix_signal_source_new ( signum) ;
521
517
glib_ffi:: g_source_set_callback ( source, Some ( trampoline :: < F > ) , into_raw ( func) , Some ( destroy_closure :: < F > ) ) ;
522
518
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
523
519
524
- let name = name. into ( ) ;
525
520
if let Some ( name) = name {
526
521
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
527
522
}
@@ -536,14 +531,13 @@ where F: FnMut() -> Continue + Send + 'static {
536
531
///
537
532
/// `func` will be called repeatedly while the file descriptor matches the given IO condition
538
533
/// until it returns `Continue(false)`.
539
- pub fn unix_fd_source_new < ' a , N : Into < Option < & ' a str > > , F > ( fd : RawFd , condition : IOCondition , name : N , priority : Priority , func : F ) -> Source
534
+ pub fn unix_fd_source_new < F > ( fd : RawFd , condition : IOCondition , name : Option < & str > , priority : Priority , func : F ) -> Source
540
535
where F : FnMut ( RawFd , IOCondition ) -> Continue + Send + ' static {
541
536
unsafe {
542
537
let source = glib_ffi:: g_unix_fd_source_new ( fd, condition. to_glib ( ) ) ;
543
538
glib_ffi:: g_source_set_callback ( source, Some ( transmute ( trampoline_unix_fd :: < F > as usize ) ) , into_raw_unix_fd ( func) , Some ( destroy_closure_unix_fd :: < F > ) ) ;
544
539
glib_ffi:: g_source_set_priority ( source, priority. to_glib ( ) ) ;
545
540
546
- let name = name. into ( ) ;
547
541
if let Some ( name) = name {
548
542
glib_ffi:: g_source_set_name ( source, name. to_glib_none ( ) . 0 ) ;
549
543
}
@@ -553,8 +547,7 @@ where F: FnMut(RawFd, IOCondition) -> Continue + Send + 'static {
553
547
}
554
548
555
549
impl Source {
556
- pub fn attach < ' a , P : Into < Option < & ' a MainContext > > > ( & self , context : P ) -> SourceId {
557
- let context = context. into ( ) ;
550
+ pub fn attach ( & self , context : Option < & MainContext > ) -> SourceId {
558
551
unsafe {
559
552
from_glib ( ffi:: g_source_attach ( self . to_glib_none ( ) . 0 , context. to_glib_none ( ) . 0 ) )
560
553
}
0 commit comments