Trait std::ops::SubExperimental
[-]
[+]
[src]
pub trait Sub<RHS, Result> { fn sub(self, rhs: RHS) -> Result; }
The Sub
trait is used to specify the functionality of -
.
Example
A trivial implementation of Sub
. When Foo - Foo
happens, it ends up
calling sub
, and therefore, main
prints Subtracting!
.
#[deriving(Copy)] struct Foo; impl Sub<Foo, Foo> for Foo { fn sub(self, _rhs: Foo) -> Foo { println!("Subtracting!"); self } } fn main() { Foo - Foo; }
Required Methods
fn sub(self, rhs: RHS) -> Result
The method for the -
operator
Implementors
impl Sub<uint, uint> for uint
impl Sub<u8, u8> for u8
impl Sub<u16, u16> for u16
impl Sub<u32, u32> for u32
impl Sub<u64, u64> for u64
impl Sub<int, int> for int
impl Sub<i8, i8> for i8
impl Sub<i16, i16> for i16
impl Sub<i32, i32> for i32
impl Sub<i64, i64> for i64
impl Sub<f32, f32> for f32
impl Sub<f64, f64> for f64
impl Sub<FilePermission, FilePermission> for FilePermission
impl Sub<Duration, Duration> for Duration
impl<'a, 'b, T: Eq + Hash<S> + Clone, S, H: Hasher<S> + Default> Sub<&'b HashSet<T, H>, HashSet<T, H>> for &'a HashSet<T, H>
impl<'a, 'b, T: Eq + Hash<S> + Clone, S, H: Hasher<S> + Default> Sub<&'b HashSet<T, H>, HashSet<T, H>> for &'a HashSet<T, H>
impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<T>
impl<E: CLike> Sub<EnumSet<E>, EnumSet<E>> for EnumSet<E>