Skip to content

Commit 3986181

Browse files
author
Jorge Aparicio
committedMar 8, 2015
add OpAssign traits
1 parent b0746ff commit 3986181

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
 

‎src/libcore/ops.rs

+80
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,86 @@ macro_rules! shr_impl_all {
880880

881881
shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
882882

883+
#[cfg(not(stage0))]
884+
/// `+=`
885+
#[lang = "add_assign"]
886+
pub trait AddAssign<Rhs=Self> {
887+
/// `+=`
888+
fn add_assign(&mut self, &Rhs);
889+
}
890+
891+
#[cfg(not(stage0))]
892+
/// `&=`
893+
#[lang = "bitand_assign"]
894+
pub trait BitAndAssign<Rhs=Self> {
895+
/// `&=`
896+
fn bitand_assign(&mut self, &Rhs);
897+
}
898+
899+
#[cfg(not(stage0))]
900+
/// `|=`
901+
#[lang = "bitor_assign"]
902+
pub trait BitOrAssign<Rhs=Self> {
903+
/// `|=`
904+
fn bitor_assign(&mut self, &Rhs);
905+
}
906+
907+
#[cfg(not(stage0))]
908+
/// `^=`
909+
#[lang = "bitxor_assign"]
910+
pub trait BitXorAssign<Rhs=Self> {
911+
/// `^=`
912+
fn bitxor_assign(&mut self, &Rhs);
913+
}
914+
915+
#[cfg(not(stage0))]
916+
/// `/=`
917+
#[lang = "div_assign"]
918+
pub trait DivAssign<Rhs=Self> {
919+
/// `/=`
920+
fn div_assign(&mut self, &Rhs);
921+
}
922+
923+
#[cfg(not(stage0))]
924+
/// `*=`
925+
#[lang = "mul_assign"]
926+
pub trait MulAssign<Rhs=Self> {
927+
/// `*=`
928+
fn mul_assign(&mut self, &Rhs);
929+
}
930+
931+
#[cfg(not(stage0))]
932+
/// `%=`
933+
#[lang = "rem_assign"]
934+
pub trait RemAssign<Rhs=Self> {
935+
/// `%=`
936+
fn rem_assign(&mut self, &Rhs);
937+
}
938+
939+
#[cfg(not(stage0))]
940+
/// `<<=`
941+
#[lang = "shl_assign"]
942+
pub trait ShlAssign<Rhs> {
943+
/// `<<=`
944+
fn shl_assign(&mut self, &Rhs);
945+
}
946+
947+
#[cfg(not(stage0))]
948+
/// `>>=`
949+
#[lang = "shr_assign"]
950+
pub trait ShrAssign<Rhs> {
951+
/// `>>=`
952+
fn shr_assign(&mut self, &Rhs);
953+
}
954+
955+
#[cfg(not(stage0))]
956+
/// `-=`
957+
#[lang = "sub_assign"]
958+
pub trait SubAssign<Rhs=Self> {
959+
/// `-=`
960+
fn sub_assign(&mut self, &Rhs);
961+
}
962+
883963
/// The `Index` trait is used to specify the functionality of indexing operations
884964
/// like `arr[idx]` when used in an immutable context.
885965
///

0 commit comments

Comments
 (0)
Please sign in to comment.