add more built-in traits to dox.rs

This commit is contained in:
Andrew Cann 2018-06-01 13:49:03 +08:00
parent 6578c7c7d1
commit 0eaa305c71

View file

@ -91,12 +91,39 @@ mod imp {
fn sub(self, rhs: RHS) -> Self::Output;
}
#[lang = "bitand"]
pub trait BitAnd<RHS=Self> {
type Output;
fn bitand(self, rhs: RHS) -> Self::Output;
}
#[lang = "bitand_assign"]
pub trait BitAndAssign<RHS = Self> {
fn bitand_assign(&mut self, rhs: RHS);
}
#[lang = "bitor"]
pub trait Bitor<RHS=Self> {
pub trait BitOr<RHS=Self> {
type Output;
fn bitor(self, rhs: RHS) -> Self::Output;
}
#[lang = "bitor_assign"]
pub trait BitOrAssign<RHS = Self> {
fn bitor_assign(&mut self, rhs: RHS);
}
#[lang = "bitxor"]
pub trait BitXor<RHS=Self> {
type Output;
fn bitxor(self, rhs: RHS) -> Self::Output;
}
#[lang = "bitxor_assign"]
pub trait BitXorAssign<RHS = Self> {
fn bitxor_assign(&mut self, rhs: RHS);
}
#[lang = "neg"]
pub trait Neg {
type Output;
@ -134,10 +161,27 @@ mod imp {
type Output = $i;
fn sub(self, rhs: $i) -> $i { self - rhs }
}
impl Bitor for $i {
impl BitAnd for $i {
type Output = $i;
fn bitand(self, rhs: $i) -> $i { self & rhs }
}
impl BitAndAssign for $i {
fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; }
}
impl BitOr for $i {
type Output = $i;
fn bitor(self, rhs: $i) -> $i { self | rhs }
}
impl BitOrAssign for $i {
fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; }
}
impl BitXor for $i {
type Output = $i;
fn bitxor(self, rhs: $i) -> $i { self ^ rhs }
}
impl BitXorAssign for $i {
fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; }
}
impl Neg for $i {
type Output = $i;
fn neg(self) -> $i { -self }