Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

google/impl_trait_utils

Development has moved to https://github.com/rust-lang/impl-trait-utils.


impl_trait_utils

Utilities for working with impl traits in Rust.

trait_transformer

Trait transformer is an experimental crate that generates specialized versions of a base trait. For example, if you want a Sendable version of your trait, you'd write:

#[trait_transformer(SendIntFactory: Send)]
trait IntFactory {
    async fn make(&self) -> i32;
    // ..or..
    fn stream(&self) -> impl Iterator<Item = i32>;
    fn call(&self) -> u32;
}

Which creates a new SendIntFactory: IntFactory + Send trait and additionally bounds SendIntFactory::make(): Send and SendIntFactory::stream(): Send. The generated sytax is still experimental, as it relies on the nightly and unstable async_fn_in_trait, return_position_impl_trait_in_trait, and return_type_notation features.

License and usage notes

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

This is not an officially supported Google product.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages