Add serde serialization support for the full clif ir

This commit is contained in:
bjorn3
2020-12-19 16:32:46 +01:00
parent 7b4652bb82
commit 2fc964ea35
25 changed files with 195 additions and 4 deletions

View File

@@ -10,6 +10,9 @@
use core::fmt;
use core::mem;
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
/// Types that have a reserved value which can't be created any other way.
pub trait ReservedValue {
/// Create an instance of the reserved value.
@@ -20,6 +23,7 @@ pub trait ReservedValue {
/// Packed representation of `Option<T>`.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct PackedOption<T: ReservedValue>(T);
impl<T: ReservedValue> PackedOption<T> {