59
59
//! See the documentation for each trait for a minimum implementation that prints
60
60
//! something to the screen.
61
61
62
+ #![ stable]
63
+
62
64
use clone:: Clone ;
63
65
use iter:: { Step , Iterator , DoubleEndedIterator , ExactSizeIterator } ;
64
66
use kinds:: Sized ;
@@ -86,8 +88,10 @@ use option::Option::{self, Some, None};
86
88
/// }
87
89
/// ```
88
90
#[ lang="drop" ]
91
+ #[ stable]
89
92
pub trait Drop {
90
93
/// The `drop` method, called when the value goes out of scope.
94
+ #[ stable]
91
95
fn drop ( & mut self ) ;
92
96
}
93
97
@@ -120,15 +124,19 @@ pub trait Drop {
120
124
/// }
121
125
/// ```
122
126
#[ lang="add" ]
127
+ #[ stable]
123
128
pub trait Add < RHS =Self > {
129
+ #[ stable]
124
130
type Output ;
125
131
126
132
/// The method for the `+` operator
133
+ #[ stable]
127
134
fn add ( self , rhs : RHS ) -> Self :: Output ;
128
135
}
129
136
130
137
macro_rules! add_impl {
131
138
( $( $t: ty) * ) => ( $(
139
+ #[ stable]
132
140
impl Add for $t {
133
141
type Output = $t;
134
142
@@ -169,15 +177,19 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
169
177
/// }
170
178
/// ```
171
179
#[ lang="sub" ]
180
+ #[ stable]
172
181
pub trait Sub < RHS =Self > {
182
+ #[ stable]
173
183
type Output ;
174
184
175
185
/// The method for the `-` operator
186
+ #[ stable]
176
187
fn sub ( self , rhs : RHS ) -> Self :: Output ;
177
188
}
178
189
179
190
macro_rules! sub_impl {
180
191
( $( $t: ty) * ) => ( $(
192
+ #[ stable]
181
193
impl Sub for $t {
182
194
type Output = $t;
183
195
@@ -218,15 +230,19 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
218
230
/// }
219
231
/// ```
220
232
#[ lang="mul" ]
233
+ #[ stable]
221
234
pub trait Mul < RHS =Self > {
235
+ #[ stable]
222
236
type Output ;
223
237
224
238
/// The method for the `*` operator
239
+ #[ stable]
225
240
fn mul ( self , rhs : RHS ) -> Self :: Output ;
226
241
}
227
242
228
243
macro_rules! mul_impl {
229
244
( $( $t: ty) * ) => ( $(
245
+ #[ stable]
230
246
impl Mul for $t {
231
247
type Output = $t;
232
248
@@ -267,15 +283,19 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
267
283
/// }
268
284
/// ```
269
285
#[ lang="div" ]
286
+ #[ stable]
270
287
pub trait Div < RHS =Self > {
288
+ #[ stable]
271
289
type Output ;
272
290
273
291
/// The method for the `/` operator
292
+ #[ stable]
274
293
fn div ( self , rhs : RHS ) -> Self :: Output ;
275
294
}
276
295
277
296
macro_rules! div_impl {
278
297
( $( $t: ty) * ) => ( $(
298
+ #[ stable]
279
299
impl Div for $t {
280
300
type Output = $t;
281
301
@@ -316,15 +336,19 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
316
336
/// }
317
337
/// ```
318
338
#[ lang="rem" ]
339
+ #[ stable]
319
340
pub trait Rem < RHS =Self > {
341
+ #[ stable]
320
342
type Output = Self ;
321
343
322
344
/// The method for the `%` operator
345
+ #[ stable]
323
346
fn rem ( self , rhs : RHS ) -> Self :: Output ;
324
347
}
325
348
326
349
macro_rules! rem_impl {
327
350
( $( $t: ty) * ) => ( $(
351
+ #[ stable]
328
352
impl Rem for $t {
329
353
type Output = $t;
330
354
@@ -336,6 +360,7 @@ macro_rules! rem_impl {
336
360
337
361
macro_rules! rem_float_impl {
338
362
( $t: ty, $fmod: ident) => {
363
+ #[ stable]
339
364
impl Rem for $t {
340
365
type Output = $t;
341
366
@@ -382,26 +407,33 @@ rem_float_impl! { f64, fmod }
382
407
/// }
383
408
/// ```
384
409
#[ lang="neg" ]
410
+ #[ stable]
385
411
pub trait Neg {
412
+ #[ stable]
386
413
type Output ;
387
414
388
415
/// The method for the unary `-` operator
416
+ #[ stable]
389
417
fn neg ( self ) -> Self :: Output ;
390
418
}
391
419
392
420
macro_rules! neg_impl {
393
421
( $( $t: ty) * ) => ( $(
422
+ #[ stable]
394
423
impl Neg for $t {
424
+ #[ stable]
395
425
type Output = $t;
396
426
397
427
#[ inline]
428
+ #[ stable]
398
429
fn neg( self ) -> $t { -self }
399
430
}
400
431
) * )
401
432
}
402
433
403
434
macro_rules! neg_uint_impl {
404
435
( $t: ty, $t_signed: ty) => {
436
+ #[ stable]
405
437
impl Neg for $t {
406
438
type Output = $t;
407
439
@@ -450,15 +482,19 @@ neg_uint_impl! { u64, i64 }
450
482
/// }
451
483
/// ```
452
484
#[ lang="not" ]
485
+ #[ stable]
453
486
pub trait Not {
487
+ #[ stable]
454
488
type Output ;
455
489
456
490
/// The method for the unary `!` operator
491
+ #[ stable]
457
492
fn not ( self ) -> Self :: Output ;
458
493
}
459
494
460
495
macro_rules! not_impl {
461
496
( $( $t: ty) * ) => ( $(
497
+ #[ stable]
462
498
impl Not for $t {
463
499
type Output = $t;
464
500
@@ -499,15 +535,19 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
499
535
/// }
500
536
/// ```
501
537
#[ lang="bitand" ]
538
+ #[ stable]
502
539
pub trait BitAnd < RHS =Self > {
540
+ #[ stable]
503
541
type Output ;
504
542
505
543
/// The method for the `&` operator
544
+ #[ stable]
506
545
fn bitand ( self , rhs : RHS ) -> Self :: Output ;
507
546
}
508
547
509
548
macro_rules! bitand_impl {
510
549
( $( $t: ty) * ) => ( $(
550
+ #[ stable]
511
551
impl BitAnd for $t {
512
552
type Output = $t;
513
553
@@ -548,15 +588,19 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
548
588
/// }
549
589
/// ```
550
590
#[ lang="bitor" ]
591
+ #[ stable]
551
592
pub trait BitOr < RHS =Self > {
593
+ #[ stable]
552
594
type Output ;
553
595
554
596
/// The method for the `|` operator
597
+ #[ stable]
555
598
fn bitor ( self , rhs : RHS ) -> Self :: Output ;
556
599
}
557
600
558
601
macro_rules! bitor_impl {
559
602
( $( $t: ty) * ) => ( $(
603
+ #[ stable]
560
604
impl BitOr for $t {
561
605
type Output = $t;
562
606
@@ -597,15 +641,19 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
597
641
/// }
598
642
/// ```
599
643
#[ lang="bitxor" ]
644
+ #[ stable]
600
645
pub trait BitXor < RHS =Self > {
646
+ #[ stable]
601
647
type Output ;
602
648
603
649
/// The method for the `^` operator
650
+ #[ stable]
604
651
fn bitxor ( self , rhs : RHS ) -> Self :: Output ;
605
652
}
606
653
607
654
macro_rules! bitxor_impl {
608
655
( $( $t: ty) * ) => ( $(
656
+ #[ stable]
609
657
impl BitXor for $t {
610
658
type Output = $t;
611
659
@@ -646,15 +694,19 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
646
694
/// }
647
695
/// ```
648
696
#[ lang="shl" ]
697
+ #[ stable]
649
698
pub trait Shl < RHS > {
699
+ #[ stable]
650
700
type Output ;
651
701
652
702
/// The method for the `<<` operator
703
+ #[ stable]
653
704
fn shl ( self , rhs : RHS ) -> Self :: Output ;
654
705
}
655
706
656
707
macro_rules! shl_impl {
657
708
( $( $t: ty) * ) => ( $(
709
+ #[ stable]
658
710
impl Shl <uint> for $t {
659
711
type Output = $t;
660
712
@@ -697,10 +749,13 @@ shl_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
697
749
/// }
698
750
/// ```
699
751
#[ lang="shr" ]
752
+ #[ stable]
700
753
pub trait Shr < RHS > {
754
+ #[ stable]
701
755
type Output ;
702
756
703
757
/// The method for the `>>` operator
758
+ #[ stable]
704
759
fn shr ( self , rhs : RHS ) -> Self :: Output ;
705
760
}
706
761
@@ -913,11 +968,13 @@ pub trait SliceMut<Sized? Idx, Sized? Result> for Sized? {
913
968
/// An unbounded range.
914
969
#[ derive( Copy ) ]
915
970
#[ lang="full_range" ]
971
+ #[ unstable = "API still in development" ]
916
972
pub struct FullRange ;
917
973
918
974
/// A (half-open) range which is bounded at both ends.
919
975
#[ derive( Copy ) ]
920
976
#[ lang="range" ]
977
+ #[ unstable = "API still in development" ]
921
978
pub struct Range < Idx > {
922
979
/// The lower bound of the range (inclusive).
923
980
pub start : Idx ,
@@ -968,6 +1025,7 @@ impl<Idx: Clone + Step> ExactSizeIterator for Range<Idx> {}
968
1025
/// A range which is only bounded below.
969
1026
#[ derive( Copy ) ]
970
1027
#[ lang="range_from" ]
1028
+ #[ unstable = "API still in development" ]
971
1029
pub struct RangeFrom < Idx > {
972
1030
/// The lower bound of the range (inclusive).
973
1031
pub start : Idx ,
@@ -988,6 +1046,7 @@ impl<Idx: Clone + Step> Iterator for RangeFrom<Idx> {
988
1046
/// A range which is only bounded above.
989
1047
#[ derive( Copy ) ]
990
1048
#[ lang="range_to" ]
1049
+ #[ unstable = "API still in development" ]
991
1050
pub struct RangeTo < Idx > {
992
1051
/// The upper bound of the range (exclusive).
993
1052
pub end : Idx ,
@@ -1025,19 +1084,24 @@ pub struct RangeTo<Idx> {
1025
1084
/// }
1026
1085
/// ```
1027
1086
#[ lang="deref" ]
1087
+ #[ stable]
1028
1088
pub trait Deref for Sized ? {
1089
+ #[ stable]
1029
1090
type Sized ? Target ;
1030
1091
1031
1092
/// The method called to dereference a value
1093
+ #[ stable]
1032
1094
fn deref < ' a > ( & ' a self ) -> & ' a Self :: Target ;
1033
1095
}
1034
1096
1097
+ #[ stable]
1035
1098
impl < ' a , Sized ? T > Deref for & ' a T {
1036
1099
type Target = T ;
1037
1100
1038
1101
fn deref ( & self ) -> & T { * self }
1039
1102
}
1040
1103
1104
+ #[ stable]
1041
1105
impl < ' a , Sized ? T > Deref for & ' a mut T {
1042
1106
type Target = T ;
1043
1107
@@ -1082,31 +1146,37 @@ impl<'a, Sized? T> Deref for &'a mut T {
1082
1146
/// }
1083
1147
/// ```
1084
1148
#[ lang="deref_mut" ]
1149
+ #[ stable]
1085
1150
pub trait DerefMut for Sized ? : Deref {
1086
1151
/// The method called to mutably dereference a value
1152
+ #[ stable]
1087
1153
fn deref_mut < ' a > ( & ' a mut self ) -> & ' a mut <Self as Deref >:: Target ;
1088
1154
}
1089
1155
1156
+ #[ stable]
1090
1157
impl < ' a , Sized ? T > DerefMut for & ' a mut T {
1091
1158
fn deref_mut ( & mut self ) -> & mut T { * self }
1092
1159
}
1093
1160
1094
1161
/// A version of the call operator that takes an immutable receiver.
1095
1162
#[ lang="fn" ]
1163
+ #[ unstable = "uncertain about variadic generics, input versus associated types" ]
1096
1164
pub trait Fn < Args , Result > for Sized ? {
1097
1165
/// This is called when the call operator is used.
1098
1166
extern "rust-call" fn call ( & self , args : Args ) -> Result ;
1099
1167
}
1100
1168
1101
1169
/// A version of the call operator that takes a mutable receiver.
1102
1170
#[ lang="fn_mut" ]
1171
+ #[ unstable = "uncertain about variadic generics, input versus associated types" ]
1103
1172
pub trait FnMut < Args , Result > for Sized ? {
1104
1173
/// This is called when the call operator is used.
1105
1174
extern "rust-call" fn call_mut ( & mut self , args : Args ) -> Result ;
1106
1175
}
1107
1176
1108
1177
/// A version of the call operator that takes a by-value receiver.
1109
1178
#[ lang="fn_once" ]
1179
+ #[ unstable = "uncertain about variadic generics, input versus associated types" ]
1110
1180
pub trait FnOnce < Args , Result > {
1111
1181
/// This is called when the call operator is used.
1112
1182
extern "rust-call" fn call_once ( self , args : Args ) -> Result ;
0 commit comments