pub enum RestrictionMode {
Blacklist(Vec<Address>),
Whitelist(Vec<Address>),
}Variants§
Blacklist(Vec<Address>)
Blacklist - specified actors are blocked.
Whitelist(Vec<Address>)
Whitelist - only specified actors are allowed.
Implementations§
Source§impl RestrictionMode
impl RestrictionMode
Sourcepub const fn is_blacklist(&self) -> bool
pub const fn is_blacklist(&self) -> bool
Returns true if this value is of type Blacklist. Returns false otherwise
Sourcepub const fn is_whitelist(&self) -> bool
pub const fn is_whitelist(&self) -> bool
Returns true if this value is of type Whitelist. Returns false otherwise
Source§impl RestrictionMode
impl RestrictionMode
pub fn blacklist(addresses: Vec<Address>) -> Self
pub fn whitelist(addresses: Vec<Address>) -> Self
pub fn normalized(self) -> Self
Sourcepub fn is_restricted(&self, actor_id: &Address) -> Option<RestrictionKind>
pub fn is_restricted(&self, actor_id: &Address) -> Option<RestrictionKind>
Check if the given actor is restricted.
Returns Some(kind) if blocked, None if allowed.
The returned RestrictionKind is a lightweight tag — no allocations.
§Arguments
actor_id- The actor to check.
pub fn is_restricted_allowing_self( &self, actor_id: &Address, self_id: &Address, ) -> Option<RestrictionKind>
Trait Implementations§
Source§impl BorshDeserialize for RestrictionMode
impl BorshDeserialize for RestrictionMode
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSchema for RestrictionMode
impl BorshSchema for RestrictionMode
Source§fn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
Source§fn add_definitions_recursively(
definitions: &mut BTreeMap<Declaration, Definition>,
)
fn add_definitions_recursively( definitions: &mut BTreeMap<Declaration, Definition>, )
Recursively, using DFS, add type definitions required for this type.
Type definition partially explains how to serialize/deserialize a type.
Source§impl BorshSerialize for RestrictionMode
impl BorshSerialize for RestrictionMode
Source§impl Clone for RestrictionMode
impl Clone for RestrictionMode
Source§fn clone(&self) -> RestrictionMode
fn clone(&self) -> RestrictionMode
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RestrictionMode
impl Debug for RestrictionMode
Source§impl<'de> Deserialize<'de> for RestrictionMode
impl<'de> Deserialize<'de> for RestrictionMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl EnumExt for RestrictionMode
impl EnumExt for RestrictionMode
Source§impl JsonSchema for RestrictionMode
impl JsonSchema for RestrictionMode
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for RestrictionMode
impl PartialEq for RestrictionMode
Source§impl Serialize for RestrictionMode
impl Serialize for RestrictionMode
impl Eq for RestrictionMode
impl StructuralPartialEq for RestrictionMode
Auto Trait Implementations§
impl Freeze for RestrictionMode
impl RefUnwindSafe for RestrictionMode
impl Send for RestrictionMode
impl Sync for RestrictionMode
impl Unpin for RestrictionMode
impl UnwindSafe for RestrictionMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.