File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 1
1
//! Types for isolating deserialization failures. See [`DeserializeGuard`].
2
2
3
- use std:: { borrow:: Cow , fmt :: Display } ;
3
+ use std:: borrow:: Cow ;
4
4
5
5
use k8s_openapi:: apimachinery:: pkg:: apis:: meta:: v1:: ObjectMeta ;
6
6
use serde:: Deserialize ;
7
7
use serde_value:: DeserializerError ;
8
+ use thiserror:: Error ;
8
9
9
10
use crate :: { PartialObjectMeta , Resource } ;
10
11
@@ -17,7 +18,8 @@ use crate::{PartialObjectMeta, Resource};
17
18
pub struct DeserializeGuard < K > ( pub Result < K , InvalidObject > ) ;
18
19
19
20
/// An object that failed to be deserialized by the [`DeserializeGuard`].
20
- #[ derive( Debug , Clone ) ]
21
+ #[ derive( Debug , Clone , Error ) ]
22
+ #[ error( "{error}" ) ]
21
23
pub struct InvalidObject {
22
24
// Should ideally be D::Error, but we don't know what type it has outside of Deserialize::deserialize()
23
25
// It *could* be Box<std::error::Error>, but we don't know that it is Send+Sync
@@ -27,12 +29,6 @@ pub struct InvalidObject {
27
29
pub metadata : ObjectMeta ,
28
30
}
29
31
30
- impl Display for InvalidObject {
31
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
32
- self . error . fmt ( f)
33
- }
34
- }
35
-
36
32
impl < ' de , K > Deserialize < ' de > for DeserializeGuard < K >
37
33
where
38
34
K : Deserialize < ' de > ,
You can’t perform that action at this time.
0 commit comments