Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generics and impl Trait types #18

Open
foresterre opened this issue Mar 6, 2024 · 0 comments
Open

Add support for generics and impl Trait types #18

foresterre opened this issue Mar 6, 2024 · 0 comments

Comments

@foresterre
Copy link
Owner

foresterre commented Mar 6, 2024

  • TODO:
    • Figure out limitations to this approach. Will it scale with async for example
    • Where should the __generated fn be placed? Is it good enough to put it in the module, or, especially for custom macro's, do we want the implementation to be stacked inside the #[maybe_my_custom_test] fn?

Can we replace the current binding based implementation completely? Or do we want or need to keep both?

#[parameterized(a = { 0 }, b = { 1 })]
fn numbers<T: Into<u8>>(input: T) {
    assert_eq!(0, input)
}

mod test {
    #[test]
    fn a() {
        fn __generated<T: Into<u8>>(input: T) {
            assert_eq!(0, input.into());
        }

        __generated(0); 
    }

    #[test]
    fn b() {
        fn __generated<T: Into<u8>>(input: T) {
            assert_eq!(0, input.into());
        }

        __generated(1);
    }
}

and

fn __generated(input: impl Into<u8>) {
            assert_eq!(0, input.into());
        }

        __generated(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant