1
0
forked from M-Labs/nac3

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

View File

@ -48,3 +48,10 @@ impl<'ctx> Model<'ctx> for 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)
}
}