use libavif_sys as sys;
use std::fmt::{Binary, Formatter, LowerHex, Octal, UpperHex};
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(transparent)]
pub struct AddImageFlags(sys::avifAddImageFlags);
impl AddImageFlags {
pub const NONE: Self = Self(sys::AVIF_ADD_IMAGE_FLAG_NONE);
pub const KEYFRAME: Self = Self(sys::AVIF_ADD_IMAGE_FLAG_FORCE_KEYFRAME);
pub const SINGLE: Self = Self(sys::AVIF_ADD_IMAGE_FLAG_SINGLE);
}
impl Binary for AddImageFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Binary::fmt(&self.0, f)
}
}
impl BitAnd<AddImageFlags> for AddImageFlags {
type Output = Self;
fn bitand(self, rhs: AddImageFlags) -> Self::Output {
Self(self.0 & rhs.0)
}
}
impl BitAndAssign<AddImageFlags> for AddImageFlags {
fn bitand_assign(&mut self, rhs: AddImageFlags) {
self.0 &= rhs.0
}
}
impl BitOr<AddImageFlags> for AddImageFlags {
type Output = Self;
fn bitor(self, rhs: AddImageFlags) -> Self::Output {
Self(self.0 | rhs.0)
}
}
impl BitOrAssign<AddImageFlags> for AddImageFlags {
fn bitor_assign(&mut self, rhs: AddImageFlags) {
self.0 |= rhs.0
}
}
impl BitXor<AddImageFlags> for AddImageFlags {
type Output = Self;
fn bitxor(self, rhs: AddImageFlags) -> Self::Output {
Self(self.0 ^ rhs.0)
}
}
impl BitXorAssign<AddImageFlags> for AddImageFlags {
fn bitxor_assign(&mut self, rhs: AddImageFlags) {
self.0 ^= rhs.0
}
}
impl Default for AddImageFlags {
fn default() -> Self {
Self::NONE
}
}
impl From<AddImageFlags> for sys::avifAddImageFlags {
fn from(flags: AddImageFlags) -> Self {
flags.0
}
}
impl LowerHex for AddImageFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
LowerHex::fmt(&self.0, f)
}
}
impl UpperHex for AddImageFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
UpperHex::fmt(&self.0, f)
}
}
impl Octal for AddImageFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Octal::fmt(&self.0, f)
}
}
impl Not for AddImageFlags {
type Output = Self;
fn not(self) -> Self::Output {
Self(Not::not(self.0))
}
}