Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(specialization)]
- use std::ops::Deref;
- pub struct UserId(i64);
- impl<S> From<S> for UserId
- where
- S: Deref,
- S::Target: Into<UserId>,
- {
- default fn from(s: S) -> Self {
- s.deref().into()
- }
- }
- impl From<i64> for UserId {
- fn from(id: i64) -> Self {
- UserId(id)
- }
- }
- fn main() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement