[−][src]Struct ichen_openprotocol::JobCard
A data structure containing information on a production job (i.e. a job card).
Methods
impl<'a> JobCard<'a>
[src]
pub fn job_card_id(&self) -> &str
[src]
Get the job ID.
Examples
let jc = JobCard::try_new("J001", "Mold#001", 100, 1000)?; assert_eq!("J001", jc.job_card_id());
pub fn mold_id(&self) -> &str
[src]
Get the mold ID.
Examples
let jc = JobCard::try_new("J001", "Mold#001", 100, 1000)?; assert_eq!("Mold#001", jc.mold_id());
pub fn progress(&self) -> u32
[src]
Get the production progress.
Examples
let jc = JobCard::try_new("J001", "Mold#001", 100, 1000)?; assert_eq!(100, jc.progress());
pub fn total(&self) -> u32
[src]
Get the maximum production order.
Examples
let jc = JobCard::try_new("J001", "Mold#001", 100, 1000)?; assert_eq!(1000, jc.total());
pub fn try_new(
id: &'a str,
mold: &'a str,
progress: u32,
total: u32
) -> Result<Self, String>
[src]
id: &'a str,
mold: &'a str,
progress: u32,
total: u32
) -> Result<Self, String>
Create a new JobCard
with the specified field values.
Errors
Returns Err(String)
is there is an error in the parameters.
Error Examples
assert_eq!( Err("invalid value: a non-empty, non-whitespace string required for job card ID".into()), JobCard::try_new("", "Mold#001", 0, 10000) ); assert_eq!( Err("invalid value: a non-empty, non-whitespace string required for mold ID".into()), JobCard::try_new("J001", " ", 0, 10000) ); assert_eq!( Err("progress cannot be larger than total".into()), JobCard::try_new("J001", "Mold#001", 1000, 100) );
Examples
let jobs = vec![ JobCard::try_new("J001", "Mold#001", 0, 10000)?, JobCard::try_new("J002", "Mold#002", 1000, 5000)?, JobCard::try_new("J003", "Mold#003", 42, 1000)?, JobCard::try_new("J004", "Mold#004", 0, 0)?, ]; assert_eq!(4, jobs.len()); assert_eq!("J002", jobs[1].job_card_id()); assert_eq!(1000, jobs[2].total());
Trait Implementations
impl<'a> Clone for JobCard<'a>
[src]
impl<'a> Debug for JobCard<'a>
[src]
impl<'de: 'a, 'a> Deserialize<'de> for JobCard<'a>
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> Eq for JobCard<'a>
[src]
impl<'a> Hash for JobCard<'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<JobCard<'a>> for JobCard<'a>
[src]
impl<'a> Serialize for JobCard<'a>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'a> StructuralEq for JobCard<'a>
[src]
impl<'a> StructuralPartialEq for JobCard<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for JobCard<'a>
impl<'a> Send for JobCard<'a>
impl<'a> Sync for JobCard<'a>
impl<'a> Unpin for JobCard<'a>
impl<'a> UnwindSafe for JobCard<'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>,