Struct dazeus::Scope [] [src]

pub struct Scope {
    pub network: Option<String>,
    pub sender: Option<String>,
    pub receiver: Option<String>,
}

A scope for retrieving permissions and properties.

A scope is an optional limitation on which some property or permission applies. A scope consists of three different elements:

Note that for a sender or receiver scope, you also should provide a network, as it makes no sense to for example provide a permission to the same channel on different networks (they are only the same in name, but might be completely different in context).

The most generic scope (and easiest one to start with) is one applied to everything. Such a scope can be created by the Scope::any() method.

Fields

network

The network on which the scope is limited (if any).

sender

The sender on which the scope is limited (if any).

receiver

The receiver on which the scope is limited (if any).

Methods

impl Scope

fn new(network: Option<String>, sender: Option<String>, receiver: Option<String>) -> Scope

Construct a new scope with the specified limitations for network, sender and receiver

fn any() -> Scope

Scope to everyone and anything

fn network(network: &str) -> Scope

Scope to a specific network

fn sender(network: &str, sender: &str) -> Scope

Scope to a specific sender (typically a channel)

fn receiver(network: &str, receiver: &str) -> Scope

Scope to a specific receiver (typically a user)

fn to(network: &str, sender: &str, receiver: &str) -> Scope

Scope to a specific receiver and channel (typically a user in a channel)

fn is_any(&self) -> bool

Checks whether the scope is set to be applied to everything.

Trait Implementations

impl ToJson for Scope

fn to_json(&self) -> Json

Derived Implementations

impl PartialEq for Scope

fn eq(&self, __arg_0: &Scope) -> bool

fn ne(&self, __arg_0: &Scope) -> bool

impl Clone for Scope

fn clone(&self) -> Scope

fn clone_from(&mut self, source: &Self)

impl Debug for Scope

fn fmt(&self, __arg_0: &mut Formatter) -> Result