use crate::encode::{Encode, Encoding};
use super::InnerIvarType;
#[repr(transparent)]
pub struct IvarBool(bool);
unsafe impl Encode for IvarBool {
const ENCODING: Encoding = Encoding::Bool;
}
impl super::ivar::private::Sealed for IvarBool {}
unsafe impl InnerIvarType for IvarBool {
type Output = bool;
#[inline]
unsafe fn __deref(&self) -> &Self::Output {
&self.0
}
#[inline]
unsafe fn __deref_mut(&mut self) -> &mut Self::Output {
&mut self.0
}
}
#[cfg(test)]
mod tests {
use super::*;
use core::mem;
#[test]
fn needs_drop() {
assert!(!mem::needs_drop::<IvarBool>());
assert_eq!(mem::size_of::<IvarBool>(), mem::size_of::<bool>());
}
}