Rust 1.56.0
09c42c458

# Casting between types

There is a new edition of the book and this is an old link.

> A type cast expression is denoted with the binary operator `as`. Executing an `as` expression casts the value on the left-hand side to the type on the right-hand side.

    fn average(values: &[f64]) -> f64 {
        let sum: f64 = sum(values);
        let size: f64 = len(values) as f64;
        sum / size
    }

Run

Here are the relevant sections in the new and old books:

- in the current edition: Appendix A — Keywords
- In the Rust Reference: Type Cast Expressions
- In the Rust documentation: `mem::transmute`
- In the first edition: Ch 3.29 — Casting between types