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 on Queue.

fn say_hello(out: &mut Write)


This function's parameter is a mutable reference to any value that implements the Write trait

fn min<T: Ord>(value1: T, value2: T)


This function can be used with arguments of any type T that implements the Ord trait

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 as T implements the Debug, Hash, and Eq traits

impl<W: Write> WriteHtml for W


Here's an implementation of the WriteHtml trait for any type W that implements Write

trait Creature: Visible {


Every type that implements Creature must also implement the Visible trait. Creature is a subtrait of (extends) Visible.

trait Iterator {
    type Item;

Item is an associated type of the Iterator trait. Any type that implements Iterator must specify the Item type.

impl Iterator for Args {
    type Item = String;

The implementation of Iterator for Args has an associated Item type of String.

fn dump<I>(iter: I) where I: Iterator<Item=String>


The type parameter I must be an iterator over String values

trait Mul<RHS=Self> {


The type parameter RHS of this trait defaults to Self.


#![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 Rand trait uses the Rng trait as a bound. Rand and Rng are buddy traits.

impl<T> Add for Complex<T> where T: Add<Output=T>


Overloads the + operator for values of Complex<T> types, where T must already implement the Add (+ operator) trait.

trait PartialEq<Rhs: ?Sized = Self>


This is a trait signature whose Rhs type parameter does not have to be a sized type. That means this trait could be implemented for types like &str or &[T]. We'd say that Rhs is 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 T into a collection of type C (where C implements the FromIterator<T> trait), then you can collect items of type Result<T, E> into a single result of type Result<C, E>.