Translations
&T
Immutable reference to a value of type
T.
&[T]
Reference to a slice containing data of type
T.
impl<T> Queue<T>
For any type
T, here are some methods available onQueue.
fn say_hello(out: &mut Write)
This function's parameter is a mutable reference to any value that implements the
Writetrait
fn min<T: Ord>(value1: T, value2: T)
This function can be used with arguments of any type T that implements the
Ordtrait
fn top_ten<T: Debug + Hash + Eq>(values: &Vec<T>)
This function can be used with an argument that is a vector reference of any type
T, as long asTimplements theDebug,Hash, andEqtraits
impl<W: Write> WriteHtml for W
Here's an implementation of the
WriteHtmltrait for any typeWthat implementsWrite
trait Creature: Visible {
Every type that implements
Creaturemust also implement theVisibletrait.Creatureis a subtrait of (extends)Visible.
trait Iterator { type Item;
Itemis an associated type of theIteratortrait. Any type that implementsIteratormust specify theItemtype.
impl Iterator for Args { type Item = String;
The implementation of
IteratorforArgshas an associated Item type ofString.
fn dump<I>(iter: I) where I: Iterator<Item=String>
The type parameter
Imust be an iterator overStringvalues
trait Mul<RHS=Self> {
The type parameter
RHSof this trait defaults toSelf.
#![allow(unused)] fn main() { pub trait Rng { fn next_u32(&mut self) -> u32; } pub trait Rand: Sized { fn rand<R: Rng>(rng: &mut R) -> Self; } }
The
Randtrait uses theRngtrait as a bound.RandandRngare buddy traits.
impl<T> Add for Complex<T> where T: Add<Output=T>
Overloads the
+operator for values ofComplex<T>types, whereTmust already implement theAdd(+operator) trait.
trait PartialEq<Rhs: ?Sized = Self>
This is a trait signature whose
Rhstype parameter does not have to be a sized type. That means this trait could be implemented for types like&stror&[T]. We'd say thatRhsis questionably sized.
#![allow(unused)] fn main() { impl<T, E, C> FromIterator<Result<T, E>> for Result<C, E> where C: FromIterator<T> { ... } }
If you can collect items of type
Tinto a collection of typeC(whereCimplements theFromIterator<T>trait), then you can collect items of typeResult<T, E>into a single result of typeResult<C, E>.