# Struct permissions::LockdownRestrictions

> The restrictions a lockdown names.

`zaun_community_protocol::permissions::LockdownRestrictions` · Struct

```rust
pub struct LockdownRestrictions(…)
```

The restrictions a lockdown names.

## Methods

### `empty`

```rust
pub const fn empty() -> Self
```

Get a flags value with all bits unset.

### `all`

```rust
pub const fn all() -> Self
```

Get a flags value with all known bits set.

### `bits`

```rust
pub const fn bits(&self) -> u16
```

Get the underlying bits value.

The returned value is exactly the bits set in this flags value.

### `from_bits`

```rust
pub const fn from_bits(bits: u16) -> Option<Self>
```

Convert from a bits value.

This method will return `None` if any unknown bits are set.

### `from_bits_truncate`

```rust
pub const fn from_bits_truncate(bits: u16) -> Self
```

Convert from a bits value, unsetting any unknown bits.

### `from_bits_retain`

```rust
pub const fn from_bits_retain(bits: u16) -> Self
```

Convert from a bits value exactly.

### `from_name`

```rust
pub fn from_name(name: &str) -> Option<Self>
```

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.

### `is_empty`

```rust
pub const fn is_empty(&self) -> bool
```

Whether all bits in `self` are unset.

### `is_all`

```rust
pub const fn is_all(&self) -> bool
```

Whether all known bits in this flags value are set.

### `intersects`

```rust
pub const fn intersects(&self, other: Self) -> bool
```

Whether any set bits in `other` are also set in `self`.

### `contains`

```rust
pub const fn contains(&self, other: Self) -> bool
```

Whether all set bits in `other` are also set in `self`.

### `insert`

```rust
pub fn insert(&mut self, other: Self)
```

The bitwise or (`|`) of the bits in `self` and `other`.

### `remove`

```rust
pub fn remove(&mut self, other: Self)
```

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.

### `toggle`

```rust
pub fn toggle(&mut self, other: Self)
```

The bitwise exclusive-or (`^`) of the bits in `self` and `other`.

### `set`

```rust
pub fn set(&mut self, other: Self, value: bool)
```

Call `insert` when `value` is `true` or `remove` when `value` is `false`.

### `intersection`

```rust
pub const fn intersection(self, other: Self) -> Self
```

The bitwise and (`&`) of the bits in `self` and `other`.

### `union`

```rust
pub const fn union(self, other: Self) -> Self
```

The bitwise or (`|`) of the bits in `self` and `other`.

### `difference`

```rust
pub const fn difference(self, other: Self) -> Self
```

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.

### `symmetric_difference`

```rust
pub const fn symmetric_difference(self, other: Self) -> Self
```

The bitwise exclusive-or (`^`) of the bits in `self` and `other`.

### `complement`

```rust
pub const fn complement(self) -> Self
```

The bitwise negation (`!`) of the bits in `self`, truncating the result.

### `iter`

```rust
pub const fn iter(&self) -> Iter<LockdownRestrictions>
```

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.

### `iter_names`

```rust
pub const fn iter_names(&self) -> IterNames<LockdownRestrictions>
```

Yield a set of contained named flags values.

This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.

### `from_wire`

```rust
pub fn from_wire(name: &str) -> Option<Self>
```

Parses one wire name; `None` for an unknown restriction.

### `permission_mask`

```rust
pub fn permission_mask(self) -> Permissions
```

The bits every member loses while these restrictions are active, before the
per-member `restrict_newcomers` part (permissions the protocol).

## Trait implementations

`Binary`, `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign`, `BitXor`, `BitXorAssign`, `Clone`, `Copy`, `Debug`, `Default`, `Eq`, `Extend<LockdownRestrictions>`, `Flags`, `FromIterator<LockdownRestrictions>`, `Hash`, `IntoIterator`, `LowerHex`, `Not`, `Octal`, `PartialEq`, `PublicFlags`, `StructuralPartialEq`, `Sub`, `SubAssign`, `UpperHex`

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/lockdown/restrictions/struct.LockdownRestrictions.html)
