pub struct Nits(/* private fields */);Expand description
A finite, strictly positive luminance in cd/m². Used for source/display peaks independently of the relative-linear white anchor.
Internally stored as a NonZeroU32 IEEE 754 bit pattern so Option<Nits>
fits in 4 bytes via Rust niche optimization.
Implementations§
Source§impl Nits
impl Nits
Sourcepub const fn new_positive(value: f32) -> Option<Nits>
pub const fn new_positive(value: f32) -> Option<Nits>
Construct a strictly positive luminance in cd/m², returning None unless value is
finite and strictly greater than 0.0 (returns None for 0.0, negatives, NaN, Inf).
Sourcepub const fn new_positive_or_panic(value: f32) -> Nits
pub const fn new_positive_or_panic(value: f32) -> Nits
Construct a strictly positive luminance in cd/m², panicking on invalid input.
Intended for const items and validated literals; prefer new_positive
for runtime inputs.
§Panics
Panics for zero, negative, NaN or infinite values.
Trait Implementations§
impl Copy for Nits
impl Eq for Nits
impl StructuralPartialEq for Nits
Auto Trait Implementations§
impl Freeze for Nits
impl RefUnwindSafe for Nits
impl Send for Nits
impl Sync for Nits
impl Unpin for Nits
impl UnsafeUnpin for Nits
impl UnwindSafe for Nits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more