♻️ Error cleanup
This commit is contained in:
parent
7f37965ed4
commit
40039eca17
@ -14,7 +14,7 @@
|
|||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use std::fmt::{self, Error};
|
use std::fmt;
|
||||||
|
|
||||||
/// Machine Error
|
/// Machine Error
|
||||||
/// This error serves as a specific exception handler for the Machine struct
|
/// This error serves as a specific exception handler for the Machine struct
|
||||||
@ -24,23 +24,22 @@ pub struct MachineError {
|
|||||||
message: String
|
message: String
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MachineError {
|
/// This impl allows this MachineError to be formatted into an empty format.
|
||||||
|
///
|
||||||
/// MachineError constructor
|
/// ```
|
||||||
pub fn new(message: &str) -> MachineError {
|
/// // Result of printing a MachineError
|
||||||
MachineError {
|
/// let m = MachineError::new("Lorem Ipsum");
|
||||||
message: message.to_string()
|
/// println!("Example: {}", m);
|
||||||
}
|
/// ```
|
||||||
}
|
///
|
||||||
|
/// Console output:Error}
|
||||||
}
|
/// ```
|
||||||
|
/// example Lorem Ipsum
|
||||||
|
/// ```
|
||||||
impl fmt::Display for MachineError {
|
impl fmt::Display for MachineError {
|
||||||
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "Machine error: {}", &self.message)
|
write!(f, "Machine error: {}", &self.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&str> for MachineError {
|
impl From<&str> for MachineError {
|
||||||
|
Loading…
Reference in New Issue
Block a user