Trait nng::options::Options[][src]

pub trait Options: HasOpts {
    fn get_opt<T: OptOps>(&self) -> Result<T::OptType>
    where
        Self: GetOpt<T>
, { ... }
fn set_opt<T: OptOps>(&self, val: T::OptType) -> Result<()>
    where
        Self: SetOpt<T>
, { ... } }
Expand description

Trait for getting and setting options.

This trait allows for the getting and setting of options as long as that option is available. An example of this would be the Raw option - it is a read-only option that is available exclusively to sockets. So the following code will work:

use nng::options::{Options, Raw};
use nng::*;

let socket = Socket::new(Protocol::Pub0).unwrap();
let raw = socket.get_opt::<Raw>().unwrap();
assert!(!raw);

But all this is a compile error:

use nng::options::{Options, Raw};
use nng::*;

let socket = Socket::new(Protocol::Pub0).unwrap();
socket.set_opt::<Raw>(true).unwrap(); // Won't compile

Provided methods

Reads the specified option from the object.

Writes the specified option to the object.

Implementors