pub struct TablePerms(/* private fields */);Expand description
Per-table permission bits.
Bits combine via the BitOr/BitAnd operators provided by
[bitflags]. The wire encoding is a single u8, mirrored on the
IC canister surface as a Candid nat8.
Implementations§
Source§impl TablePerms
impl TablePerms
Sourcepub const READ: TablePerms
pub const READ: TablePerms
Permission to run SELECT / aggregate against the table.
Sourcepub const INSERT: TablePerms
pub const INSERT: TablePerms
Permission to run INSERT against the table.
Sourcepub const UPDATE: TablePerms
pub const UPDATE: TablePerms
Permission to run UPDATE against the table.
Sourcepub const DELETE: TablePerms
pub const DELETE: TablePerms
Permission to run DELETE against the table.
Source§impl TablePerms
impl TablePerms
Sourcepub const fn empty() -> TablePerms
pub const fn empty() -> TablePerms
Get a flags value with all bits unset.
Sourcepub const fn all() -> TablePerms
pub const fn all() -> TablePerms
Get a flags value with all known bits set.
Sourcepub const fn bits(&self) -> u8
pub const fn bits(&self) -> u8
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u8) -> Option<TablePerms>
pub const fn from_bits(bits: u8) -> Option<TablePerms>
Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u8) -> TablePerms
pub const fn from_bits_truncate(bits: u8) -> TablePerms
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u8) -> TablePerms
pub const fn from_bits_retain(bits: u8) -> TablePerms
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<TablePerms>
pub fn from_name(name: &str) -> Option<TablePerms>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: TablePerms) -> bool
pub const fn intersects(&self, other: TablePerms) -> bool
Whether any set bits in other are also set in self.
Sourcepub const fn contains(&self, other: TablePerms) -> bool
pub const fn contains(&self, other: TablePerms) -> bool
Whether all set bits in other are also set in self.
Sourcepub fn insert(&mut self, other: TablePerms)
pub fn insert(&mut self, other: TablePerms)
The bitwise or (|) of the bits in self and other.
Sourcepub fn remove(&mut self, other: TablePerms)
pub fn remove(&mut self, other: TablePerms)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: TablePerms)
pub fn toggle(&mut self, other: TablePerms)
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub fn set(&mut self, other: TablePerms, value: bool)
pub fn set(&mut self, other: TablePerms, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: TablePerms) -> TablePerms
pub const fn intersection(self, other: TablePerms) -> TablePerms
The bitwise and (&) of the bits in self and other.
Sourcepub const fn union(self, other: TablePerms) -> TablePerms
pub const fn union(self, other: TablePerms) -> TablePerms
The bitwise or (|) of the bits in self and other.
Sourcepub const fn difference(self, other: TablePerms) -> TablePerms
pub const fn difference(self, other: TablePerms) -> TablePerms
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: TablePerms) -> TablePerms
pub const fn symmetric_difference(self, other: TablePerms) -> TablePerms
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub const fn complement(self) -> TablePerms
pub const fn complement(self) -> TablePerms
The bitwise negation (!) of the bits in self, truncating the result.
Source§impl TablePerms
impl TablePerms
Sourcepub const fn iter(&self) -> Iter<TablePerms>
pub const fn iter(&self) -> Iter<TablePerms>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<TablePerms>
pub const fn iter_names(&self) -> IterNames<TablePerms>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
Source§impl Binary for TablePerms
impl Binary for TablePerms
Source§impl BitAnd for TablePerms
impl BitAnd for TablePerms
Source§fn bitand(self, other: TablePerms) -> TablePerms
fn bitand(self, other: TablePerms) -> TablePerms
The bitwise and (&) of the bits in self and other.
Source§type Output = TablePerms
type Output = TablePerms
& operator.Source§impl BitAndAssign for TablePerms
impl BitAndAssign for TablePerms
Source§fn bitand_assign(&mut self, other: TablePerms)
fn bitand_assign(&mut self, other: TablePerms)
The bitwise and (&) of the bits in self and other.
Source§impl BitOr for TablePerms
impl BitOr for TablePerms
Source§fn bitor(self, other: TablePerms) -> TablePerms
fn bitor(self, other: TablePerms) -> TablePerms
The bitwise or (|) of the bits in self and other.
Source§type Output = TablePerms
type Output = TablePerms
| operator.Source§impl BitOrAssign for TablePerms
impl BitOrAssign for TablePerms
Source§fn bitor_assign(&mut self, other: TablePerms)
fn bitor_assign(&mut self, other: TablePerms)
The bitwise or (|) of the bits in self and other.
Source§impl BitXor for TablePerms
impl BitXor for TablePerms
Source§fn bitxor(self, other: TablePerms) -> TablePerms
fn bitxor(self, other: TablePerms) -> TablePerms
The bitwise exclusive-or (^) of the bits in self and other.
Source§type Output = TablePerms
type Output = TablePerms
^ operator.Source§impl BitXorAssign for TablePerms
impl BitXorAssign for TablePerms
Source§fn bitxor_assign(&mut self, other: TablePerms)
fn bitxor_assign(&mut self, other: TablePerms)
The bitwise exclusive-or (^) of the bits in self and other.
Source§impl CandidType for TablePerms
Available on crate feature candid only.
impl CandidType for TablePerms
candid only.Source§impl Clone for TablePerms
impl Clone for TablePerms
Source§fn clone(&self) -> TablePerms
fn clone(&self) -> TablePerms
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TablePerms
impl Debug for TablePerms
Source§impl Default for TablePerms
impl Default for TablePerms
Source§fn default() -> TablePerms
fn default() -> TablePerms
Source§impl<'de> Deserialize<'de> for TablePerms
impl<'de> Deserialize<'de> for TablePerms
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TablePerms, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TablePerms, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Extend<TablePerms> for TablePerms
impl Extend<TablePerms> for TablePerms
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TablePerms>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TablePerms>,
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for TablePerms
impl Flags for TablePerms
Source§const FLAGS: &'static [Flag<TablePerms>]
const FLAGS: &'static [Flag<TablePerms>]
Source§fn from_bits_retain(bits: u8) -> TablePerms
fn from_bits_retain(bits: u8) -> TablePerms
Source§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
Source§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
Source§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
Source§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS.Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.Source§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Source§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.Source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl FromIterator<TablePerms> for TablePerms
impl FromIterator<TablePerms> for TablePerms
Source§fn from_iter<T>(iterator: T) -> TablePermswhere
T: IntoIterator<Item = TablePerms>,
fn from_iter<T>(iterator: T) -> TablePermswhere
T: IntoIterator<Item = TablePerms>,
The bitwise or (|) of the bits in each flags value.
Source§impl Hash for TablePerms
impl Hash for TablePerms
Source§impl IntoIterator for TablePerms
impl IntoIterator for TablePerms
Source§type Item = TablePerms
type Item = TablePerms
Source§type IntoIter = Iter<TablePerms>
type IntoIter = Iter<TablePerms>
Source§fn into_iter(self) -> <TablePerms as IntoIterator>::IntoIter
fn into_iter(self) -> <TablePerms as IntoIterator>::IntoIter
Source§impl LowerHex for TablePerms
impl LowerHex for TablePerms
Source§impl Not for TablePerms
impl Not for TablePerms
Source§fn not(self) -> TablePerms
fn not(self) -> TablePerms
The bitwise negation (!) of the bits in self, truncating the result.
Source§type Output = TablePerms
type Output = TablePerms
! operator.Source§impl Octal for TablePerms
impl Octal for TablePerms
Source§impl PartialEq for TablePerms
impl PartialEq for TablePerms
Source§impl Serialize for TablePerms
impl Serialize for TablePerms
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Sub for TablePerms
impl Sub for TablePerms
Source§fn sub(self, other: TablePerms) -> TablePerms
fn sub(self, other: TablePerms) -> TablePerms
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Source§type Output = TablePerms
type Output = TablePerms
- operator.Source§impl SubAssign for TablePerms
impl SubAssign for TablePerms
Source§fn sub_assign(&mut self, other: TablePerms)
fn sub_assign(&mut self, other: TablePerms)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.