add #[hdl(get(|v| ...))] type GetStuff<P: PhantomConstGet<MyStruct>> = MyType or DynSize;
This commit is contained in:
parent
d2c8b023bf
commit
094c77e26e
8 changed files with 600 additions and 58 deletions
|
|
@ -4,7 +4,6 @@ use fayalite::{
|
|||
bundle::BundleType,
|
||||
enum_::EnumType,
|
||||
int::{BoolOrIntType, IntType},
|
||||
phantom_const::PhantomConst,
|
||||
prelude::*,
|
||||
ty::StaticType,
|
||||
};
|
||||
|
|
@ -197,3 +196,21 @@ check_bounds!(CheckBoundsTTT2<#[a, Type] A: BundleType +, #[b, Type] B: Type +,
|
|||
check_bounds!(CheckBoundsTTT3<#[a, Type] A: EnumType +, #[b, Type] B: Type +, #[c, Type] C: Type +>);
|
||||
check_bounds!(CheckBoundsTTT4<#[a, Type] A: IntType +, #[b, Type] B: Type +, #[c, Type] C: Type +>);
|
||||
check_bounds!(CheckBoundsTTT5<#[a, Type] A: StaticType +, #[b, Type] B: Type +, #[c, Type] C: Type +>);
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MyPhantomConstInner {
|
||||
pub a: usize,
|
||||
pub b: UInt,
|
||||
}
|
||||
|
||||
#[hdl(outline_generated, get(|v| v.a))]
|
||||
pub type GetA<P: PhantomConstGet<MyPhantomConstInner>> = DynSize;
|
||||
|
||||
#[hdl(outline_generated, get(|v| v.b))]
|
||||
pub type GetB<P: PhantomConstGet<MyPhantomConstInner>> = UInt;
|
||||
|
||||
#[hdl(outline_generated, no_static)]
|
||||
pub struct MyTypeWithPhantomConstParameter<P: Type + PhantomConstGet<MyPhantomConstInner>> {
|
||||
pub a: ArrayType<Bool, GetA<P>>,
|
||||
pub b: HdlOption<GetB<P>>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue