add some ExprCastTo supertraits to ResetType to make generic code easier

This commit is contained in:
Jacob Lifshay 2024-12-01 20:10:25 -08:00
parent 965fe53077
commit 12b3ba57f1
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ

View file

@ -1,8 +1,9 @@
// SPDX-License-Identifier: LGPL-3.0-or-later // SPDX-License-Identifier: LGPL-3.0-or-later
// See Notices.txt for copyright information // See Notices.txt for copyright information
use crate::{ use crate::{
expr::{Expr, ToExpr}, clock::Clock,
int::Bool, expr::{ops, Expr, ToExpr},
int::{Bool, SInt, UInt},
source_location::SourceLocation, source_location::SourceLocation,
ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties}, ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties},
}; };
@ -11,7 +12,19 @@ mod sealed {
pub trait ResetTypeSealed {} pub trait ResetTypeSealed {}
} }
pub trait ResetType: StaticType<MaskType = Bool> + sealed::ResetTypeSealed { pub trait ResetType:
StaticType<MaskType = Bool>
+ sealed::ResetTypeSealed
+ ops::ExprCastTo<Bool>
+ ops::ExprCastTo<Reset>
+ ops::ExprCastTo<SyncReset>
+ ops::ExprCastTo<AsyncReset>
+ ops::ExprCastTo<Clock>
+ ops::ExprCastTo<UInt<1>>
+ ops::ExprCastTo<SInt<1>>
+ ops::ExprCastTo<UInt>
+ ops::ExprCastTo<SInt>
{
fn dispatch<D: ResetTypeDispatch>(input: D::Input<Self>, dispatch: D) -> D::Output<Self>; fn dispatch<D: ResetTypeDispatch>(input: D::Input<Self>, dispatch: D) -> D::Output<Self>;
} }