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

assert_impl_all! with serde::Deserialize #30

Open
SOF3 opened this issue Nov 21, 2019 · 1 comment
Open

assert_impl_all! with serde::Deserialize #30

SOF3 opened this issue Nov 21, 2019 · 1 comment

Comments

@SOF3
Copy link

SOF3 commented Nov 21, 2019

serde::Deserialize takes the lifetime parameter <'de>. How should I check that a class derives serde::Deserialize?

One of the working solutions is assert_impl_all!(MyType : serde::Deserialize<'static>);, using the trick that 'static is available everywhere. However, is this the best practice?

Please consider adding this note to the documentation.

@Nadrieril
Copy link
Contributor

If/when #28 gets accepted, I believe the following would work:

assert_impl!(for('a) MyType : serde::Deserialize<'a>);

In the meantime, I think using 'static is indeed the best we can do.

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

2 participants