12
12
13
13
#[ allow( missing_doc) ] ;
14
14
15
- use local_data:: { local_data_pop, local_data_set} ;
16
15
use local_data;
17
16
use prelude:: * ;
18
17
@@ -26,14 +25,14 @@ pub struct Handler<T, U> {
26
25
27
26
pub struct Condition < ' self , T , U > {
28
27
name : & ' static str ,
29
- key : local_data:: LocalDataKey < ' self , @Handler < T , U > >
28
+ key : local_data:: Key < ' self , @Handler < T , U > >
30
29
}
31
30
32
31
impl < ' self , T , U > Condition < ' self , T , U > {
33
32
pub fn trap ( & ' self self , h : & ' self fn ( T ) -> U ) -> Trap < ' self , T , U > {
34
33
unsafe {
35
34
let p : * RustClosure = :: cast:: transmute ( & h) ;
36
- let prev = local_data:: local_data_get ( self . key ) ;
35
+ let prev = local_data:: get ( self . key ) ;
37
36
let h = @Handler { handle : * p, prev : prev } ;
38
37
Trap { cond : self , handler : h }
39
38
}
@@ -46,7 +45,7 @@ impl<'self, T, U> Condition<'self, T, U> {
46
45
47
46
pub fn raise_default ( & self , t : T , default : & fn ( ) -> U ) -> U {
48
47
unsafe {
49
- match local_data_pop ( self . key ) {
48
+ match local_data :: pop ( self . key ) {
50
49
None => {
51
50
debug ! ( "Condition.raise: found no handler" ) ;
52
51
default ( )
@@ -55,12 +54,12 @@ impl<'self, T, U> Condition<'self, T, U> {
55
54
debug ! ( "Condition.raise: found handler" ) ;
56
55
match handler. prev {
57
56
None => { }
58
- Some ( hp) => local_data_set ( self . key , hp)
57
+ Some ( hp) => local_data :: set ( self . key , hp)
59
58
}
60
59
let handle : & fn ( T ) -> U =
61
60
:: cast:: transmute ( handler. handle ) ;
62
61
let u = handle ( t) ;
63
- local_data_set ( self . key , handler) ;
62
+ local_data :: set ( self . key , handler) ;
64
63
u
65
64
}
66
65
}
@@ -78,7 +77,7 @@ impl<'self, T, U> Trap<'self, T, U> {
78
77
unsafe {
79
78
let _g = Guard { cond : self . cond } ;
80
79
debug ! ( "Trap: pushing handler to TLS" ) ;
81
- local_data_set ( self . cond . key , self . handler ) ;
80
+ local_data :: set ( self . cond . key , self . handler ) ;
82
81
inner ( )
83
82
}
84
83
}
@@ -93,12 +92,12 @@ impl<'self, T, U> Drop for Guard<'self, T, U> {
93
92
fn drop ( & self ) {
94
93
unsafe {
95
94
debug ! ( "Guard: popping handler from TLS" ) ;
96
- let curr = local_data_pop ( self . cond . key ) ;
95
+ let curr = local_data :: pop ( self . cond . key ) ;
97
96
match curr {
98
97
None => { }
99
98
Some ( h) => match h. prev {
100
99
None => { }
101
- Some ( hp) => local_data_set ( self . cond . key , hp)
100
+ Some ( hp) => local_data :: set ( self . cond . key , hp)
102
101
}
103
102
}
104
103
}
0 commit comments