[−][src]Macro abi_stable::tl_genparams
Use this when constructing a abi_stable::abi_stability::TypeLayoutParams
when manually implementing StableAbi,
to more ergonomically initialize the generics field.
Example
A type with lifetime type,and lifetime parameters:
use abi_stable::{ tl_genparams, StableAbi, abi_stability::type_layout::GenericParams }; struct Reference<'a,'b,T,U>(&'a T,&'b U); impl<'a,'b,T,U> Reference<'a,'b,T,U> where T:StableAbi, U:StableAbi, { const GENERICS:GenericParams= tl_genparams!('a,'b ; T,U ; ); }
Example
A type with lifetime,type,and const parameters.
Note that while this example won't compile until const parameters are usable,
ⓘThis example is not tested
use abi_stable::{ tl_genparams, StableAbi, abi_stability::type_layout::GenericParams }; struct ArrayReference<'a,'b,T,U,const SIZE_T:usize,const SIZE_U:usize>{ first:&'a [T;SIZE_T], second:&'b [U;SIZE_U], } impl<'a,'b,T,U,const SIZE_T:usize,const SIZE_U:usize> Reference<'a,'b,T,U,SIZE_T,SIZE_U> where T:StableAbi, U:StableAbi, { const GENERICS:GenericParams= tl_genparams!('a,'b ; T,U ; SIZE_T,SIZE_U ); }