This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-zerotierone/zeroidc/vendor/darling/tests/custom_bound.rs
Grant Limberg a59626c971 Bump zeroidc dependencies (#1847)
openidconnect -> 2.5
base64 -> 0.21
url -> 2.3
bytes -> 1.3
2023-01-12 13:24:58 -08:00

26 lines
541 B
Rust

#![allow(dead_code)]
use std::ops::Add;
use darling::{FromDeriveInput, FromMeta};
#[derive(Debug, Clone, FromMeta)]
#[darling(bound = "T: FromMeta + Add")]
struct Wrapper<T>(pub T);
impl<T: Add> Add for Wrapper<T> {
type Output = Wrapper<<T as Add>::Output>;
fn add(self, rhs: Self) -> Wrapper<<T as Add>::Output> {
Wrapper(self.0 + rhs.0)
}
}
#[derive(Debug, FromDeriveInput)]
#[darling(attributes(hello), bound = "Wrapper<T>: Add, T: FromMeta")]
struct Foo<T> {
lorem: Wrapper<T>,
}
#[test]
fn expansion() {}