Skip to content

Commit 2d8fe98

Browse files
committed
add better example
1 parent 5f5cb14 commit 2d8fe98

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

trait-variant/examples/variant.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use std::{future::Future, ops::Add};
9+
use std::{fmt::Display, future::Future};
1010

1111
#[trait_variant::make(IntFactory: Send)]
1212
pub trait LocalIntFactory {
@@ -37,9 +37,10 @@ where
3737
const CONST: usize = 3;
3838
type F;
3939
type A<const ANOTHER_CONST: u8>;
40-
type B<T>: Add<T>;
40+
type B<T: Display>: FromIterator<T>;
4141

4242
async fn take(&self, s: S);
43+
fn build<T: Display>(&self, items: impl Iterator<Item = T>) -> Self::B<T>;
4344
}
4445

4546
fn main() {}

0 commit comments

Comments
 (0)