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 uintimpl Sub<u8, u8> for u8impl Sub<u16, u16> for u16impl Sub<u32, u32> for u32impl Sub<u64, u64> for u64impl Sub<int, int> for intimpl Sub<i8, i8> for i8impl Sub<i16, i16> for i16impl Sub<i32, i32> for i32impl Sub<i64, i64> for i64impl Sub<f32, f32> for f32impl Sub<f64, f64> for f64impl Sub<FilePermission, FilePermission> for FilePermissionimpl Sub<Duration, Duration> for Durationimpl<'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>