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.
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.
11 //! Traits for the built-in operators
15 fn finalize(&self); // FIXME(#4332): Rename to "drop"? --pcwalton
19 pub trait Add<RHS,Result> {
20 fn add(&self, rhs: &RHS) -> Result;
24 pub trait Sub<RHS,Result> {
25 fn sub(&self, rhs: &RHS) -> Result;
29 pub trait Mul<RHS,Result> {
30 fn mul(&self, rhs: &RHS) -> Result;
34 pub trait Div<RHS,Result> {
35 fn div(&self, rhs: &RHS) -> Result;
40 pub trait Modulo<RHS,Result> {
41 fn modulo(&self, rhs: &RHS) -> Result;
45 pub trait Rem<RHS,Result> {
46 fn rem(&self, rhs: &RHS) -> Result;
50 pub trait Neg<Result> {
51 fn neg(&self) -> Result;
55 pub trait Not<Result> {
56 fn not(&self) -> Result;
60 pub trait BitAnd<RHS,Result> {
61 fn bitand(&self, rhs: &RHS) -> Result;
65 pub trait BitOr<RHS,Result> {
66 fn bitor(&self, rhs: &RHS) -> Result;
70 pub trait BitXor<RHS,Result> {
71 fn bitxor(&self, rhs: &RHS) -> Result;
75 pub trait Shl<RHS,Result> {
76 fn shl(&self, rhs: &RHS) -> Result;
80 pub trait Shr<RHS,Result> {
81 fn shr(&self, rhs: &RHS) -> Result;
85 pub trait Index<Index,Result> {
86 fn index(&self, index: &Index) -> Result;