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:

  • The network indicates for which network some property or permission should be stored.
  • The sender indicates the IRC user for which some property or permission should be stored.
  • The receiver indicates the channel for which some property or permission should be stored.

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: Option<String>

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

sender: Option<String>

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

receiver: Option<String>

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

Methods

impl Scope
[src]

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 PartialEq for Scope
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl Clone for Scope
[src]

fn clone(&self) -> Scope

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Scope
[src]

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

Formats the value using the given formatter.

impl ToJson for Scope
[src]

fn to_json(&self) -> Json

Converts the value of self to an instance of JSON