Skip to content

Commit f3ebadf

Browse files
committed
Add example comments
1 parent b7f8ae4 commit f3ebadf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

trait_transformer/src/variant.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ fn make_variant(attrs: &Attrs, tr: &ItemTrait) -> TokenStream {
9191
}
9292

9393
fn transform_item(item: &TraitItem, bounds: &Vec<TypeParamBound>) -> TraitItem {
94+
// #[variant(SendIntFactory: Send)]
95+
// trait IntFactory {
96+
// async fn make(&self, x: u32, y: &str) -> i32;
97+
// fn stream(&self) -> impl Iterator<Item = i32>;
98+
// fn call(&self) -> u32;
99+
// }
100+
//
101+
// becomes:
102+
//
103+
// trait SendIntFactory: Send {
104+
// fn make(&self, x: u32, y: &str) -> impl ::core::future::Future<Output = i32> + Send;
105+
// fn stream(&self) -> impl Iterator<Item = i32> + Send;
106+
// fn call(&self) -> u32;
107+
// }
94108
let TraitItem::Fn(fn_item @ TraitItemFn { sig, .. }) = item else {
95109
return item.clone();
96110
};
@@ -144,6 +158,13 @@ fn make_blanket_impl(attrs: &Attrs, tr: &ItemTrait) -> TokenStream {
144158
}
145159

146160
fn blanket_impl_item(item: &TraitItem, variant: &Ident) -> TokenStream {
161+
// impl<T> IntFactory for T where T: SendIntFactory {
162+
// const NAME: &'static str = <Self as SendIntFactory>::NAME;
163+
// type MyFut<'a> = <Self as SendIntFactory>::MyFut<'a> where Self: 'a;
164+
// async fn make(&self, x: u32, y: &str) -> i32 {
165+
// <Self as SendIntFactory>::make(self, x, y).await
166+
// }
167+
// }
147168
match item {
148169
TraitItem::Const(TraitItemConst {
149170
ident,

0 commit comments

Comments
 (0)