Skip to content

Commit

Permalink
Split trait_transformer back into its own crate
Browse files Browse the repository at this point in the history
  • Loading branch information
tmandry committed Dec 18, 2023
1 parent 956123d commit af495bb
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 11 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"trait-variant",
"trait-transformer",
]

resolver = "2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Implementers of the trait can choose to implement the variant instead of the ori

## `trait_transformer`

`trait_transformer` does the same thing as `make`, but using experimental nightly-only syntax that depends on the `return_type_notation` feature. It may be used to experiment with new kinds of trait transformations in the future.
`trait_transformer` does the same thing as `trait_variant`, but using experimental nightly-only syntax that depends on the `return_type_notation` feature. It may be used to experiment with new kinds of trait transformations in the future.

#### License and usage notes

Expand Down
30 changes: 30 additions & 0 deletions trait-transformer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

[package]
name = "trait-transformer"
version = "0.0.0"
description = "Utilities for working with impl traits in Rust"
categories = ["asynchronous", "no-std", "rust-patterns"]
keywords = ["async", "trait", "impl"]
license.workspace = true
repository.workspace = true
edition = "2021"

[lib]
proc-macro = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }

[dev-dependencies]
tokio = { version = "1", features = ["rt"] }
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use std::iter;

use trait_variant::trait_transformer;
use trait_transformer::trait_transformer;

#[trait_transformer(SendIntFactory: Send)]
trait IntFactory {
Expand Down
17 changes: 17 additions & 0 deletions trait-transformer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

mod transformer;

#[proc_macro_attribute]
pub fn trait_transformer(
attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
transformer::trait_transformer(attr, item)
}
File renamed without changes.
9 changes: 0 additions & 9 deletions trait-variant/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,8 @@

#![doc = include_str!("../README.md")]

mod transformer;
mod variant;

#[proc_macro_attribute]
pub fn trait_transformer(
attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
transformer::trait_transformer(attr, item)
}

#[proc_macro_attribute]
pub fn make(
attr: proc_macro::TokenStream,
Expand Down

0 comments on commit af495bb

Please sign in to comment.