2012-12-03 18:48:01 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-03-27 02:07:55 -05:00
|
|
|
//! Traits for the built-in operators
|
2012-07-25 21:03:55 -05:00
|
|
|
|
2013-05-28 16:35:52 -05:00
|
|
|
#[allow(missing_doc)];
|
|
|
|
|
2012-11-05 19:50:01 -06:00
|
|
|
#[lang="drop"]
|
|
|
|
pub trait Drop {
|
2013-06-20 20:06:13 -05:00
|
|
|
fn drop(&self);
|
2012-11-05 19:50:01 -06:00
|
|
|
}
|
|
|
|
|
2012-11-28 15:51:50 -06:00
|
|
|
#[lang="add"]
|
|
|
|
pub trait Add<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn add(&self, rhs: &RHS) -> Result;
|
2012-11-28 15:51:50 -06:00
|
|
|
}
|
|
|
|
|
2012-09-19 20:00:26 -05:00
|
|
|
#[lang="sub"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Sub<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn sub(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="mul"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Mul<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn mul(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="div"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Div<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn div(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
2013-04-21 10:58:53 -05:00
|
|
|
#[lang="rem"]
|
|
|
|
pub trait Rem<RHS,Result> {
|
|
|
|
fn rem(&self, rhs: &RHS) -> Result;
|
|
|
|
}
|
2012-09-19 20:00:26 -05:00
|
|
|
|
2012-07-25 21:03:55 -05:00
|
|
|
#[lang="neg"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Neg<Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn neg(&self) -> Result;
|
2012-07-25 21:03:55 -05:00
|
|
|
}
|
|
|
|
|
2013-01-11 11:16:58 -06:00
|
|
|
#[lang="not"]
|
|
|
|
pub trait Not<Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn not(&self) -> Result;
|
2013-01-11 11:16:58 -06:00
|
|
|
}
|
|
|
|
|
2012-09-19 20:00:26 -05:00
|
|
|
#[lang="bitand"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait BitAnd<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn bitand(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="bitor"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait BitOr<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn bitor(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="bitxor"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait BitXor<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn bitxor(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="shl"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Shl<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn shl(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[lang="shr"]
|
2012-09-28 14:30:11 -05:00
|
|
|
pub trait Shr<RHS,Result> {
|
2013-03-21 23:20:48 -05:00
|
|
|
fn shr(&self, rhs: &RHS) -> Result;
|
2012-09-19 20:00:26 -05:00
|
|
|
}
|
|
|
|
|
2012-11-28 15:51:50 -06:00
|
|
|
#[lang="index"]
|
|
|
|
pub trait Index<Index,Result> {
|
2013-03-26 14:04:30 -05:00
|
|
|
fn index(&self, index: &Index) -> Result;
|
2012-11-28 15:51:50 -06:00
|
|
|
}
|