#![cfg_attr(not(feature = "std"), no_std)] #![allow(dead_code)] // some code is tested for type checking only use derive_more::{ Add, AddAssign, Constructor, Deref, DerefMut, Display, Error, From, FromStr, Index, IndexMut, IntoIterator, Mul, MulAssign, Not, Sum, TryInto, }; #[derive( From, FromStr, Display, Index, Not, Add, Mul, Sum, IndexMut, AddAssign, MulAssign, Deref, DerefMut, IntoIterator, Constructor )] #[deref(forward)] #[deref_mut(forward)] #[into_iterator(owned, ref, ref_mut)] struct Wrapped(T); #[derive(Deref, DerefMut)] struct Wrapped2(T); #[derive(From, Not, Add, Mul, AddAssign, MulAssign, Constructor, Sum)] struct WrappedDouble(T, U); #[derive(From)] #[from(forward)] struct WrappedDouble2(T, U); #[cfg(nightly)] #[derive( From, FromStr, Display, Index, Not, Add, Mul, Sum, IndexMut, AddAssign, MulAssign, Deref, DerefMut, IntoIterator, Constructor )] struct WrappedWithConst(T); #[derive( From, FromStr, Display, Index, Not, Add, Mul, IndexMut, AddAssign, MulAssign, Deref, DerefMut, IntoIterator, Constructor, Sum )] #[deref(forward)] #[deref_mut(forward)] #[into_iterator(owned, ref, ref_mut)] struct Struct1 { t: T, } #[derive(Deref, DerefMut)] struct Struct2 { t: T, } #[derive(From, Not, Add, Mul, AddAssign, MulAssign, Constructor, Sum)] struct DoubleStruct { t: T, u: U, } #[derive(From)] #[from(forward)] struct DoubleStruct2 { t: T, u: U, } #[derive(From, Not, Add)] enum TupleEnum { Tuple(T), DoubleTuple(T, U), } #[derive(From)] #[from(forward)] enum TupleEnum2 { DoubleTuple(T, U), TripleTuple(T, U, X), } #[derive(From, Not, Add)] enum StructEnum { Struct { t: T }, DoubleStruct { t: T, u: U }, } #[derive(From)] #[from(forward)] enum StructEnum2 { DoubleStruct { t: T, u: U }, TripleStruct { t: T, u: U, x: X }, } #[derive(Debug, Display, Error)] enum Enum {} #[derive(Debug, Display, Error)] enum EnumGeneric { Inner(E), } #[derive(Debug, Display, Error)] enum EnumConst {} #[derive(Debug, Display, Error)] enum EnumConstDefault {} #[derive(Debug, Display, Error)] enum EnumLifetime<'lt: 'static> { Inner(&'lt Enum), } #[derive(Debug, Display, Error)] enum EnumConstGeneric { Inner(E), } #[derive(Debug, Display, Error)] enum EnumGenericConst { Inner(E), } #[derive(Debug, Display, Error)] enum EnumGenericConstDefault { Inner(E), } #[derive(Debug, Display, Error)] enum EnumLifetimeGeneric<'lt: 'static, E> { Inner(&'lt E), } #[derive(Debug, Display, Error)] enum EnumLifetimeConst<'lt: 'static, const X: usize> { Inner(&'lt EnumConst), } #[derive(Debug, Display, Error)] enum EnumLifetimeConstDefault<'lt: 'static, const X: usize = 42> { Inner(&'lt EnumConst), } #[derive(Debug, Display, Error)] enum EnumLifetimeConstGeneric<'lt: 'static, const X: usize, E> { Inner(&'lt E), } #[derive(Debug, Display, Error)] enum EnumLifetimeGenericConst<'lt: 'static, E, const X: usize> { Inner(&'lt E), } #[derive(Debug, Display, Error)] enum EnumLifetimeGenericConstDefault<'lt: 'static, E, const X: usize = 42> { Inner(&'lt E), } #[derive(Debug, Display, Error)] struct Struct; #[derive(Debug, Display, Error)] struct StructGeneric { inner: E, } #[derive(Debug, Display, Error)] struct StructConst {} #[derive(Debug, Display, Error)] struct StructConstDefault {} #[derive(Debug, Display, Error)] struct StructLifetime<'lt: 'static> { inner: &'lt Enum, } #[derive(Debug, Display, Error)] struct StructConstGeneric { inner: E, } #[derive(Debug, Display, Error)] struct StructGenericConst { inner: E, } #[derive(Debug, Display, Error)] struct StructGenericConstDefault { inner: E, } #[derive(Debug, Display, Error)] struct StructLifetimeGeneric<'lt: 'static, E> { inner: &'lt E, } #[derive(Debug, Display, Error)] struct StructLifetimeConst<'lt: 'static, const X: usize> { inner: &'lt EnumConst, } #[derive(Debug, Display, Error)] struct StructLifetimeConstDefault<'lt: 'static, const X: usize = 42> { inner: &'lt EnumConst, } #[derive(Debug, Display, Error)] struct StructLifetimeConstGeneric<'lt: 'static, const X: usize, E> { inner: &'lt E, } #[derive(Debug, Display, Error)] struct StructLifetimeGenericConst<'lt: 'static, E, const X: usize> { inner: &'lt E, } #[derive(Debug, Display, Error)] struct StructLifetimeGenericConstDefault<'lt: 'static, E, const X: usize = 42> { inner: &'lt E, } #[derive(Debug, Display, Error)] struct StructLifetimeGenericBoundsConstDefault< 'lt: 'static, E: Clone, const X: usize = 42, > { inner: &'lt E, } #[derive(Debug, Display)] struct Wrapper<'a, const Y: usize, U>(&'a [U; Y]); #[derive(Debug, Display, TryInto)] enum Foo<'lt: 'static, T: Clone, const X: usize> { X(Wrapper<'lt, X, T>), }