-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
*Assign
ops and Depracated *Eq
ops.
commit-id:2f5d0193
- Loading branch information
Showing
12 changed files
with
173 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
pub mod index; | ||
pub use index::{Index, IndexView}; | ||
|
||
mod arith; | ||
pub use arith::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/// The addition assignment operator `+=`. | ||
pub trait AddAssign<Lhs, Rhs> { | ||
/// Performs the `+=` operation. | ||
fn add_assign(ref self: Lhs, rhs: Rhs); | ||
} | ||
|
||
/// The subtraction assignment operator `-=`. | ||
pub trait SubAssign<Lhs, Rhs> { | ||
/// Performs the `-=` operation. | ||
fn sub_assign(ref self: Lhs, rhs: Rhs); | ||
} | ||
|
||
/// The multiplication assignment operator `*=`. | ||
pub trait MulAssign<Lhs, Rhs> { | ||
/// Performs the `*=` operation. | ||
fn mul_assign(ref self: Lhs, rhs: Rhs); | ||
} | ||
|
||
/// The division assignment operator `/=`. | ||
pub trait DivAssign<Lhs, Rhs> { | ||
/// Performs the `/=` operation. | ||
fn div_assign(ref self: Lhs, rhs: Rhs); | ||
} | ||
|
||
/// The remainder assignment operator `%=`. | ||
pub trait RemAssign<Lhs, Rhs> { | ||
/// Performs the `%=` operation. | ||
fn rem_assign(ref self: Lhs, rhs: Rhs); | ||
} | ||
|
||
#[feature("deprecated-op-assign-traits")] | ||
use core::traits::{AddEq, SubEq, MulEq, DivEq, RemEq}; | ||
|
||
impl DeprecatedAddAssign<T, impl Deprecated: AddEq<T>> of AddAssign<T, T> { | ||
fn add_assign(ref self: T, rhs: T) { | ||
Deprecated::add_eq(ref self, rhs) | ||
} | ||
} | ||
|
||
impl DeprecatedSubAssign<T, impl Deprecated: SubEq<T>> of SubAssign<T, T> { | ||
fn sub_assign(ref self: T, rhs: T) { | ||
Deprecated::sub_eq(ref self, rhs) | ||
} | ||
} | ||
|
||
impl DeprecatedMulAssign<T, impl Deprecated: MulEq<T>> of MulAssign<T, T> { | ||
fn mul_assign(ref self: T, rhs: T) { | ||
Deprecated::mul_eq(ref self, rhs) | ||
} | ||
} | ||
|
||
impl DeprecatedDivAssign<T, impl Deprecated: DivEq<T>> of DivAssign<T, T> { | ||
fn div_assign(ref self: T, rhs: T) { | ||
Deprecated::div_eq(ref self, rhs) | ||
} | ||
} | ||
|
||
impl DeprecatedRemAssign<T, impl Deprecated: RemEq<T>> of RemAssign<T, T> { | ||
fn rem_assign(ref self: T, rhs: T) { | ||
Deprecated::rem_eq(ref self, rhs) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters