use crate::lib::std::vec::Vec;
use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
#[derive(RkyvSerialize, RkyvDeserialize, Archive, Debug, Clone, PartialEq, Eq)]
#[rkyv(derive(Debug))]
pub enum CompiledFunctionUnwindInfo {
WindowsX64(Vec<u8>),
Dwarf,
}
#[allow(missing_docs)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CompiledFunctionUnwindInfoReference<'a> {
WindowsX64(&'a [u8]),
Dwarf,
}
#[allow(missing_docs)]
pub trait CompiledFunctionUnwindInfoLike<'a> {
fn get(&'a self) -> CompiledFunctionUnwindInfoReference<'a>;
}
impl<'a> CompiledFunctionUnwindInfoLike<'a> for CompiledFunctionUnwindInfo {
fn get(&'a self) -> CompiledFunctionUnwindInfoReference<'a> {
match self {
Self::WindowsX64(v) => CompiledFunctionUnwindInfoReference::WindowsX64(v.as_ref()),
Self::Dwarf => CompiledFunctionUnwindInfoReference::Dwarf,
}
}
}
impl<'a> CompiledFunctionUnwindInfoLike<'a> for ArchivedCompiledFunctionUnwindInfo {
fn get(&'a self) -> CompiledFunctionUnwindInfoReference<'a> {
match self {
Self::WindowsX64(v) => CompiledFunctionUnwindInfoReference::WindowsX64(v.as_ref()),
Self::Dwarf => CompiledFunctionUnwindInfoReference::Dwarf,
}
}
}