trait-aliases 0.1.0

Trait aliases.
Documentation

trait-aliases

License Version Downloads Documentation Test

Trait aliases.

Installation

cargo

You can add trait-aliases as a dependency with the following command:

$ cargo add trait-aliases

Or by directly specifying it in the configuration like so:

[dependencies]
trait-aliases = "0.1.0"

Alternatively, you can add it directly from the source:

[dependencies.trait-aliases]
git = "https://github.com/nekitdev/trait-aliases.git"

Example

Ever felt tired of writing T: Send + Sync + 'static over and over when working with async in multi-threaded scenarios?

Simply define an alias without blanket implementation boilerplate!

use trait_aliases::trait_aliases;

trait_aliases! {
    /// Working in multi-threaded `async` contexts often requires these.
    pub trait SSS = Send + Sync + 'static;
}

This crate will generate the SSS trait with the provided bounds, and implement it for any type satisfying them:

/// Working in multi-threaded `async` contexts often requires these.
pub trait SSS: Send + Sync + 'static {}

/// Blanket implementation of [`SSS`] for all types satisfying its bounds.
impl<__T> SSS for __T where __T: Send + Sync + 'static + ?Sized {}

Note

Please never use __T in your generic parameters, as it is reserved for the blanket implementation.

Failing to do so will result in collisions at best, and hard-to-debug errors, migraines or even spontaneous combustion at worst.

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of trait-aliases here.

Contributing

If you are interested in contributing to trait-aliases, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

trait-aliases is licensed under the MIT License terms. See License for details.