Crate rust_examples[][src]

Modules

This module contains an example of Algebraic Data Type (ADT) and the concept of pattern matching which is commonly used to work with ADTs.

This module demonstrates branded types on an example of a Vec with unchecked-indexing.

This module includes Rust’s implementation of traversable types.

This module includes Rust’s approach to dependent types.

This example demonstrates differences between a static dispatch and dynamic dispatch of method calls.

This module presents several possibilities of how to handle errors in Rust.

This module contains examples of declarative macros.

Examples in this module present how the concepts of Ownership and Borrowing work in Rust.

This module demonstrates Orphan rules and coherence of Rust’s trait system.

This module presents various kinds of pointers and their behaviour under Clone.

This module shows some examples of how Rust’s type system can be used to write safe yet efficient code.

Macros

Macro that defines “approximately equal” for expressions interpreted as f64.

Macro that counts any input tokens at compilation time (i.e. resulting in a const value) with no residual memory footprint.

Macro that automates implementation of MaxValue for arbitrary types having MAX member.

Simple macro for replacing any token $_t with expression $sub