pub struct PlatformMask(pub u8);Expand description
Bitmask of selected Platform values.
A value of 0 means “no filter — show all platforms”.
Each bit corresponds to Platform::bit().
use forensicnomicon_core::catalog::types::{Platform, PlatformMask};
let mask = PlatformMask::NONE.with(Platform::Windows).with(Platform::MacOS);
assert!(mask.matches(Platform::Windows));
assert!(mask.matches(Platform::MacOS));
assert!(!mask.matches(Platform::Linux));Tuple Fields§
§0: u8Implementations§
Source§impl PlatformMask
impl PlatformMask
Sourcepub const NONE: PlatformMask
pub const NONE: PlatformMask
Empty mask — passes all platforms (no filter active).
Sourcepub const fn contains(self, p: Platform) -> bool
pub const fn contains(self, p: Platform) -> bool
Returns true if the given platform bit is explicitly set, ignoring whether mask is empty.
Unlike matches, this returns false when the mask is empty even though an empty
mask logically passes all platforms. Use this to check whether a specific platform
is actively selected (e.g. to render a filter indicator in the UI).
Sourcepub const fn matches(self, p: Platform) -> bool
pub const fn matches(self, p: Platform) -> bool
Returns true if the given platform is selected, or if the mask is empty.
Sourcepub const fn toggle(self, p: Platform) -> PlatformMask
pub const fn toggle(self, p: Platform) -> PlatformMask
Return a new mask with the given platform toggled.
Sourcepub const fn with(self, p: Platform) -> PlatformMask
pub const fn with(self, p: Platform) -> PlatformMask
Return a new mask with the given platform added.
Trait Implementations§
Source§impl Clone for PlatformMask
impl Clone for PlatformMask
Source§fn clone(&self) -> PlatformMask
fn clone(&self) -> PlatformMask
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PlatformMask
Source§impl Debug for PlatformMask
impl Debug for PlatformMask
Source§impl Default for PlatformMask
impl Default for PlatformMask
Source§fn default() -> PlatformMask
fn default() -> PlatformMask
Returns the “default value” for a type. Read more
impl Eq for PlatformMask
Source§impl PartialEq for PlatformMask
impl PartialEq for PlatformMask
impl StructuralPartialEq for PlatformMask
Auto Trait Implementations§
impl Freeze for PlatformMask
impl RefUnwindSafe for PlatformMask
impl Send for PlatformMask
impl Sync for PlatformMask
impl Unpin for PlatformMask
impl UnsafeUnpin for PlatformMask
impl UnwindSafe for PlatformMask
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