#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NcPixelImpl {
None = c_api::NCPIXEL_NONE,
Sixel = c_api::NCPIXEL_SIXEL,
LinuxFb = c_api::NCPIXEL_LINUXFB,
Iterm2 = c_api::NCPIXEL_ITERM2,
KittyStatic = c_api::NCPIXEL_KITTY_STATIC,
KittyAnimated = c_api::NCPIXEL_KITTY_ANIMATED,
KittySelfRef = c_api::NCPIXEL_KITTY_SELFREF,
}
mod core_impls {
use super::{c_api::*, NcPixelImpl};
use core::fmt;
impl Default for NcPixelImpl {
fn default() -> Self {
Self::None
}
}
impl fmt::Display for NcPixelImpl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use NcPixelImpl::*;
write!(
f,
"{}",
match self {
NcPixelImpl::None => "None",
Sixel => "Sixel",
LinuxFb => "LinuxFb",
Iterm2 => "Iterm2",
KittyStatic => "KittyStatic",
KittyAnimated => "KittyAnimated",
KittySelfRef => "KittySelfRef",
}
)
}
}
impl From<NcPixelImpl_u32> for NcPixelImpl {
fn from(alpha: NcPixelImpl_u32) -> Self {
use NcPixelImpl::*;
match alpha {
NCPIXEL_NONE => NcPixelImpl::None,
NCPIXEL_SIXEL => Sixel,
NCPIXEL_LINUXFB => LinuxFb,
NCPIXEL_ITERM2 => Iterm2,
NCPIXEL_KITTY_STATIC => KittyStatic,
NCPIXEL_KITTY_ANIMATED => KittyAnimated,
NCPIXEL_KITTY_SELFREF => KittySelfRef,
_ => Self::default(),
}
}
}
impl From<NcPixelImpl> for NcPixelImpl_u32 {
fn from(alpha: NcPixelImpl) -> Self {
use NcPixelImpl::*;
match alpha {
NcPixelImpl::None => NCPIXEL_NONE,
Sixel => NCPIXEL_SIXEL,
LinuxFb => NCPIXEL_LINUXFB,
Iterm2 => NCPIXEL_ITERM2,
KittyStatic => NCPIXEL_KITTY_STATIC,
KittyAnimated => NCPIXEL_KITTY_ANIMATED,
KittySelfRef => NCPIXEL_KITTY_SELFREF,
}
}
}
}
pub(crate) mod c_api {
use crate::c_api::ffi;
pub type NcPixelImpl_u32 = ffi::ncpixelimpl_e;
pub const NCPIXEL_NONE: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_NONE;
pub const NCPIXEL_SIXEL: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_SIXEL;
pub const NCPIXEL_LINUXFB: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_LINUXFB;
pub const NCPIXEL_ITERM2: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_ITERM2;
pub const NCPIXEL_KITTY_STATIC: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_KITTY_STATIC;
pub const NCPIXEL_KITTY_ANIMATED: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_KITTY_ANIMATED;
pub const NCPIXEL_KITTY_SELFREF: NcPixelImpl_u32 = ffi::ncpixelimpl_e_NCPIXEL_KITTY_SELFREF;
}