]> git.lizzy.rs Git - rust.git/blob - src/libcore/ops.rs
Revert rename of Div to Quot
[rust.git] / src / libcore / ops.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Traits for the built-in operators
12
13 #[lang="drop"]
14 pub trait Drop {
15     fn finalize(&self);  // FIXME(#4332): Rename to "drop"? --pcwalton
16 }
17
18 #[lang="add"]
19 pub trait Add<RHS,Result> {
20     fn add(&self, rhs: &RHS) -> Result;
21 }
22
23 #[lang="sub"]
24 pub trait Sub<RHS,Result> {
25     fn sub(&self, rhs: &RHS) -> Result;
26 }
27
28 #[lang="mul"]
29 pub trait Mul<RHS,Result> {
30     fn mul(&self, rhs: &RHS) -> Result;
31 }
32
33 #[lang="div"]
34 pub trait Div<RHS,Result> {
35     fn div(&self, rhs: &RHS) -> Result;
36 }
37
38 #[lang="modulo"]
39 #[cfg(stage0)]
40 pub trait Modulo<RHS,Result> {
41     fn modulo(&self, rhs: &RHS) -> Result;
42 }
43 #[lang="rem"]
44 #[cfg(not(stage0))]
45 pub trait Rem<RHS,Result> {
46     fn rem(&self, rhs: &RHS) -> Result;
47 }
48
49 #[lang="neg"]
50 pub trait Neg<Result> {
51     fn neg(&self) -> Result;
52 }
53
54 #[lang="not"]
55 pub trait Not<Result> {
56     fn not(&self) -> Result;
57 }
58
59 #[lang="bitand"]
60 pub trait BitAnd<RHS,Result> {
61     fn bitand(&self, rhs: &RHS) -> Result;
62 }
63
64 #[lang="bitor"]
65 pub trait BitOr<RHS,Result> {
66     fn bitor(&self, rhs: &RHS) -> Result;
67 }
68
69 #[lang="bitxor"]
70 pub trait BitXor<RHS,Result> {
71     fn bitxor(&self, rhs: &RHS) -> Result;
72 }
73
74 #[lang="shl"]
75 pub trait Shl<RHS,Result> {
76     fn shl(&self, rhs: &RHS) -> Result;
77 }
78
79 #[lang="shr"]
80 pub trait Shr<RHS,Result> {
81     fn shr(&self, rhs: &RHS) -> Result;
82 }
83
84 #[lang="index"]
85 pub trait Index<Index,Result> {
86     fn index(&self, index: &Index) -> Result;
87 }