forked from M-Labs/nac3
1
0
Fork 0

core/model: add From<BasicValueEnum> for Opaque

This commit is contained in:
lyken 2024-07-27 01:51:18 +08:00
parent 5c6537565c
commit d2ab7b89be
1 changed files with 7 additions and 0 deletions

View File

@ -48,3 +48,10 @@ impl<'ctx> Model<'ctx> for OpaqueModel<'ctx> {
} }
pub type Opaque<'ctx> = Instance<'ctx, OpaqueModel<'ctx>>; pub type Opaque<'ctx> = Instance<'ctx, OpaqueModel<'ctx>>;
impl<'ctx> From<BasicValueEnum<'ctx>> for Opaque<'ctx> {
fn from(value: BasicValueEnum<'ctx>) -> Self {
let model = OpaqueModel(value.get_type());
model.believe_value(value)
}
}