pub mod debug_info;
use thiserror::Error;
#[doc(inline)]
pub use self::debug_info::{
CompileUnitRecord, DEBUGINFO_META_KEY, DebugRecordKind, LocationRecord, SubprogramRecord,
};
pub type RawMetadataValue = serde_json::Value;
pub trait Metadata {
const KEY: &'static str;
const ALIASES: &'static [&'static str] = &[];
type Type<'hugr>: serde::de::Deserialize<'hugr> + serde::ser::Serialize;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct HugrGenerator;
impl Metadata for HugrGenerator {
type Type<'hugr> = crate::envelope::description::GeneratorDesc;
const KEY: &'static str = "core.generator";
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct HugrUsedExtensions;
impl Metadata for HugrUsedExtensions {
type Type<'hugr> = Vec<crate::envelope::description::ExtensionDesc>;
const KEY: &'static str = "core.used_extensions";
}
#[derive(Error, Debug)]
pub enum MetadataError {
#[error("Metadata value does not deserialize to {0}: {1}")]
MetadataDeserializationError(&'static str, serde_json::Error),
}