[−][src]Struct ichen_openprotocol::StateValues
A data structure containing a snapshot of the current known states of the controller.
Methods
impl<'a> StateValues<'a>
[src]
pub fn op_mode(&self) -> OpMode
[src]
Get the op-mode.
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), None, Some("M001") )?; assert_eq!(OpMode::Automatic, state.op_mode());
pub fn job_mode(&self) -> JobMode
[src]
Get the job mode.
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), None, Some("M001") )?; assert_eq!(JobMode::ID02, state.job_mode());
pub fn operator_id(&self) -> Option<ID>
[src]
Get the operator ID, if any.
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), None, Some("M001") )?; assert_eq!(123, state.operator_id().unwrap());
pub fn job_card_id(&self) -> Option<&str>
[src]
Get the job card ID, if any.
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), Some("JC001"), None )?; assert_eq!(Some("JC001"), state.job_card_id());
pub fn mold_id(&self) -> Option<&str>
[src]
Get the mold ID, if any.
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), None, Some("M001") )?; assert_eq!(Some("M001"), state.mold_id());
pub fn new(op: OpMode, job: JobMode) -> Self
[src]
Create a new StateValues
wth no operator ID, job card ID and mold ID.
Examples
let state = StateValues::new(OpMode::Automatic, JobMode::ID02); assert_eq!(OpMode::Automatic, state.op_mode()); assert_eq!(JobMode::ID02, state.job_mode()); assert_eq!(None, state.operator_id()); assert_eq!(None, state.job_card_id()); assert_eq!(None, state.mold_id());
pub fn try_new_with_all(
op: OpMode,
job: JobMode,
operator_id: Option<ID>,
job_card_id: Option<&'a str>,
mold_id: Option<&'a str>
) -> Result<Self, String>
[src]
op: OpMode,
job: JobMode,
operator_id: Option<ID>,
job_card_id: Option<&'a str>,
mold_id: Option<&'a str>
) -> Result<Self, String>
Create a new StateValues
with all fields set.
Errors
Returns Err(String)
if job_card_id
or mold_id
is set to an empty string
or is all whitespace.
Error Examples
let sv = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), Some(""), // <-- Notice empty string for job_Card_id which is not allowed None ); assert_eq!(Err("invalid value: a non-empty, non-whitespace string required for job card ID".into()), sv);
Examples
let state = StateValues::try_new_with_all( OpMode::Automatic, JobMode::ID02, Some(ID::from_u32(123)), None, Some("M001") )?; assert_eq!(OpMode::Automatic, state.op_mode()); assert_eq!(JobMode::ID02, state.job_mode()); assert_eq!(123, state.operator_id().unwrap()); assert_eq!(None, state.job_card_id()); assert_eq!(Some("M001"), state.mold_id());
Trait Implementations
impl<'a> Clone for StateValues<'a>
[src]
fn clone(&self) -> StateValues<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for StateValues<'a>
[src]
impl<'_> Default for StateValues<'_>
[src]
impl<'de: 'a, 'a> Deserialize<'de> for StateValues<'a>
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> Eq for StateValues<'a>
[src]
impl<'a> Hash for StateValues<'a>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> PartialEq<StateValues<'a>> for StateValues<'a>
[src]
fn eq(&self, other: &StateValues<'a>) -> bool
[src]
fn ne(&self, other: &StateValues<'a>) -> bool
[src]
impl<'a> Serialize for StateValues<'a>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'a> StructuralEq for StateValues<'a>
[src]
impl<'a> StructuralPartialEq for StateValues<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for StateValues<'a>
impl<'a> Send for StateValues<'a>
impl<'a> Sync for StateValues<'a>
impl<'a> Unpin for StateValues<'a>
impl<'a> UnwindSafe for StateValues<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,