[][src]Struct artifice_manager::Manager

pub struct Manager { /* fields omitted */ }

this is the main management structure that other structures work through

Example

use networking::{ArtificeHost};

let database = ArtificeDB::default();
let manager = Manager::load(database, b"example_password").unwrap();
let host = ArtificeHost::from_host_data(manager.config());
for networkstream in host {
    // do something with the peer
}
 

Implementations

impl Manager[src]

pub fn load(database: ArtificeDB, password: &[u8]) -> Result<Self, Error>[src]

loads the configuration for artifice from its respective files in the database

Arguments

database: the database to load, password: decryption key used to read and write files

Example

use manager::{ArtificeDB, Manager}; use manager::database::Database; use networking::peers::ArtificePeer; use networking::ArtificeHost; fn main(){ let database = ArtificeDB::default(); let manager = Manager::load(database, b"example password").unwrap(); let host = ArtificeHost::from_host_data(manager.config()).unwrap(); for netstream in host { let stream = netstream.unwrap(); if manager.authenticate(stream.peer()).unwrap() { println!("peer authenticated"); } } }

pub fn config(&self) -> ArtificeConfig[src]

pub fn authenticate(&self, peer: &ArtificePeer) -> Result<bool>[src]

pub fn get_peer(&self, key: &str) -> Result<ArtificePeer>[src]

pub fn permissions(&self) -> PermissionManager[src]

pub fn peers(&self) -> ArtificePeers[src]

Trait Implementations

impl Clone for Manager[src]

impl Debug for Manager[src]

Auto Trait Implementations

impl RefUnwindSafe for Manager

impl Send for Manager

impl Sync for Manager

impl Unpin for Manager

impl UnwindSafe for Manager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,