We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
contains
Flags
1 parent 817ad57 commit 9da656cCopy full SHA for 9da656c
rust/kernel/alloc.rs
@@ -35,14 +35,19 @@ use core::{alloc::Layout, ptr::NonNull};
35
/// They can be combined with the operators `|`, `&`, and `!`.
36
///
37
/// Values can be used from the [`flags`] module.
38
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, PartialEq)]
39
pub struct Flags(u32);
40
41
impl Flags {
42
/// Get the raw representation of this flag.
43
pub(crate) fn as_raw(self) -> u32 {
44
self.0
45
}
46
+
47
+ /// Check whether `flags` is contained in `self`.
48
+ pub fn contains(self, flags: Flags) -> bool {
49
+ (self & flags) == flags
50
+ }
51
52
53
impl core::ops::BitOr for Flags {
0 commit comments