cubing_core/kpuzzle/packed/
errors.rs1use std::fmt::Display;
2
3#[derive(Debug)]
5pub struct InvalidKPatternDataError {
6 pub description: String,
7}
8
9impl From<String> for InvalidKPatternDataError {
11 fn from(description: String) -> Self {
12 Self { description }
13 }
14}
15
16impl From<&str> for InvalidKPatternDataError {
17 fn from(description: &str) -> Self {
18 Self {
19 description: description.to_owned(),
20 }
21 }
22}
23
24impl Display for InvalidKPatternDataError {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 write!(f, "{}", self.description)
27 }
28}
29
30#[derive(Debug)]
32pub struct InvalidKTransformationDataError {
33 pub description: String,
34}
35
36impl From<String> for InvalidKTransformationDataError {
38 fn from(description: String) -> Self {
39 Self { description }
40 }
41}
42
43impl From<&str> for InvalidKTransformationDataError {
44 fn from(description: &str) -> Self {
45 Self {
46 description: description.to_owned(),
47 }
48 }
49}
50
51impl Display for InvalidKTransformationDataError {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 write!(f, "{}", self.description)
54 }
55}