Commit 57ec46a 1 parent 0d8cb7d commit 57ec46a Copy full SHA for 57ec46a
File tree 7 files changed +63
-9
lines changed
7 files changed +63
-9
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ exclude = [
8
8
" projects/.DS_Store" ,
9
9
]
10
10
11
+ [workspace .dependencies ]
12
+
11
13
[profile .release ]
12
14
lto = true
13
15
panic = " abort"
Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ publish = false
4
4
version = " 0.0.0"
5
5
authors = [" Aster <192607617@qq.com>" ]
6
6
description = " ..."
7
- repository = " https://github.com/oovm/sub_projects"
7
+ categories = [" rust-patterns" ]
8
+ homepage = " https://github.com/oovm/RustTemplate"
9
+ repository = " https://github.com/oovm/RustTemplate"
8
10
documentation = " https://docs.rs/sub_projects"
9
- readme = " Readme .md"
11
+ readme = " readme .md"
10
12
license = " MPL-2.0"
11
13
edition = " 2021"
12
14
exclude = [" package.json" , " tests/**" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ use super :: * ;
2
+
3
+ impl From < ExampleErrorKind > for ExampleError {
4
+ fn from ( value : ExampleErrorKind ) -> Self {
5
+ Self {
6
+ kind : Box :: new ( value) ,
7
+ }
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ use super :: * ;
2
+
3
+ impl Error for ExampleError { }
4
+
5
+
6
+ impl Debug for ExampleError {
7
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
8
+ Debug :: fmt ( & self . kind , f)
9
+ }
10
+ }
11
+
12
+ impl Display for ExampleError {
13
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
14
+ Display :: fmt ( & self . kind , f)
15
+ }
16
+ }
17
+
18
+
19
+ impl Display for ExampleErrorKind {
20
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
21
+ match self { ExampleErrorKind :: UnknownError => { write ! ( f, "UnknownError" ) } }
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ use std:: fmt:: { Debug , Formatter } ;
2
+ use std:: error:: Error ;
3
+ use std:: fmt:: Display ;
4
+
5
+ mod display;
6
+ mod convert;
7
+
8
+ /// The result type of this crate.
9
+ pub type Result < T > = std:: result:: Result < T , ExampleError > ;
10
+
11
+ /// A boxed error kind, wrapping an [ExampleErrorKind].
12
+ #[ derive( Clone ) ]
13
+ pub struct ExampleError {
14
+ kind : Box < ExampleErrorKind > ,
15
+ }
16
+
17
+ /// The kind of [ExampleError].
18
+ #[ derive( Debug , Copy , Clone ) ]
19
+ pub enum ExampleErrorKind {
20
+ /// An unknown error.
21
+ UnknownError
22
+ }
23
+
24
+
Original file line number Diff line number Diff line change 6
6
7
7
mod errors;
8
8
9
- pub use crate :: errors:: { Error , Result } ;
9
+ pub use crate :: errors:: { ExampleErrorKind , Result , ExampleError } ;
You can’t perform that action at this time.
0 commit comments