impl Display for Conv

This commit is contained in:
tiif
2025-01-21 08:08:58 +00:00
parent 0998d4095b
commit 701b1948ab
3 changed files with 35 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
use std::fmt::Display;
use std::str::FromStr;
use std::{fmt, iter};
@@ -897,6 +898,37 @@ impl FromStr for Conv {
}
}
impl Display for Conv {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Conv::C => "C",
Conv::Rust => "Rust",
Conv::Cold => "Cold",
Conv::PreserveMost => "PreserveMost",
Conv::PreserveAll => "PreserveAll",
Conv::ArmAapcs => "ArmAapcs",
Conv::CCmseNonSecureCall => "CCmseNonSecureCall",
Conv::CCmseNonSecureEntry => "CCmseNonSecureEntry",
Conv::Msp430Intr => "Msp430Intr",
Conv::PtxKernel => "PtxKernel",
Conv::GpuKernel => "GpuKernel",
Conv::X86Fastcall => "X86Fastcall",
Conv::X86Intr => "X86Intr",
Conv::X86Stdcall => "X86Stdcall",
Conv::X86ThisCall => "X86ThisCall",
Conv::X86VectorCall => "X86VectorCall",
Conv::X86_64SysV => "X86_64SysV",
Conv::X86_64Win64 => "X86_64Win64",
Conv::AvrInterrupt => "AvrInterrupt",
Conv::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt",
Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => "RiscvInterrupt(machine)",
Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => {
"RiscvInterrupt(supervisor)"
}
})
}
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(target_pointer_width = "64")]
mod size_asserts {