[][src]Struct ichen_openprotocol::Operator

pub struct Operator<'a> { /* fields omitted */ }

A data structure containing information on a single user on the system.

Methods

impl<'a> Operator<'a>[src]

pub fn id(&self) -> ID[src]

Get the operator ID.

Examples

let opr = Operator::new(ID::from_u32(12345));
assert_eq!(12345, opr.id());

pub fn name(&self) -> Option<&str>[src]

Examples

let opr = Operator::try_new_with_name(ID::from_u32(12345), "John")?;
assert_eq!(Some("John"), opr.name());

pub fn new(id: ID) -> Self[src]

Create an Operator with just an ID and no name.

Examples

let opr = Operator::new(ID::from_u32(12345));
assert_eq!(12345, opr.id());
assert_eq!(None, opr.name());

pub fn try_new_with_name(id: ID, name: &'a str) -> Result<Self, String>[src]

Create an Operator with ID and name.

Errors

Returns Err([OpenProtocolError::EmptyField]) if the operator_name field is set to an empty string or is all whitespace.

Error Examples

let result = Operator::try_new_with_name(ID::from_u32(12345), "");
assert_eq!(Err("invalid value: a non-empty, non-whitespace string required for operator name".into()), result);

Examples

let opr = Operator::try_new_with_name(ID::from_u32(12345), "John")?;
assert_eq!(12345, opr.id());
assert_eq!(Some("John"), opr.name());

Trait Implementations

impl<'a> Clone for Operator<'a>[src]

impl<'a> Debug for Operator<'a>[src]

impl<'de: 'a, 'a> Deserialize<'de> for Operator<'a>[src]

impl<'a> Eq for Operator<'a>[src]

impl<'a> Hash for Operator<'a>[src]

impl<'a> PartialEq<Operator<'a>> for Operator<'a>[src]

impl<'a> Serialize for Operator<'a>[src]

impl<'a> StructuralEq for Operator<'a>[src]

impl<'a> StructuralPartialEq for Operator<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Operator<'a>

impl<'a> Send for Operator<'a>

impl<'a> Sync for Operator<'a>

impl<'a> Unpin for Operator<'a>

impl<'a> UnwindSafe for Operator<'a>

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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<T> Typeable for T where
    T: Any