Skip to main content

Crate trait_set

Crate trait_set 

Source
Expand description

This crate provides support for trait aliases: a feature that is already supported by the Rust compiler, but is not stable yet.

The idea is simple: combine a group of traits under a single name. The simplest example is:

use trait_set::trait_set;

trait_set! {
    pub trait ThreadSafe = Send + Sync;
}

The trait_set macro displayed here is the main entity of the crate: it allows declaring multiple trait aliases, each of which is represented as:

[visibility] trait [AliasName][<generics>] = [Element1] + [Element2] + ... + [ElementN];

For more details, see the trait_set macro documentation.

Macrosยง

trait_set
Creates an alias for a set of traits.