Debian Codegraph @

src/error.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# as StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/, stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/};
3
4 use base64rust-analyzer cargo base64 0.22.1 crate/;
5
6 /// The `Error` type represents the possible errors that may occur when
7 /// working with OpenSSH keys.
8 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
9 pub struct Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
10 pub(craterust-analyzer cargo sshkeys 0.3.4 crate/) kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind.: ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#,
11 }
12
13 impl Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
14 pub(craterust-analyzer cargo sshkeys 0.3.4 crate/) fn with_kindrust-analyzer cargo sshkeys 0.3.4 error/impl#[Error]with_kind().(kind: ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#) -> Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
15 Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# { kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind.: kind }
16 }
17 }
18
19 /// A type to represent the different kinds of errors.
20 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
21 pub(craterust-analyzer cargo sshkeys 0.3.4 crate/) enum ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind# {
22 Iorust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#),
23 Decoderust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Decode#(base64rust-analyzer cargo base64 0.22.1 crate/::DecodeErrorrust-analyzer cargo base64 0.22.1 decode/DecodeError#),
24 Utf8Errorrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Utf8Error#(stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#),
25 InvalidCertTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidCertType#(u32),
26 InvalidFormatrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidFormat#,
27 UnexpectedEofrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnexpectedEof#,
28 NotCertificaterust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#NotCertificate#,
29 KeyTypeMismatchrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#KeyTypeMismatch#,
30 UnknownKeyTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownKeyType#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
31 UnknownCurverust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownCurve#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
32 }
33
34 /// A `Result` type alias where the `Err` variant is `Error`
35 pub type Resultrust-analyzer cargo sshkeys 0.3.4 error/Result#<T> = resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Errorrust-analyzer cargo sshkeys 0.3.4 error/Error#>;
36
37 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
38 fn fromrust-analyzer cargo sshkeys 0.3.4 error/impl#[Error][`From<io::Error>`]from().(error: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
39 Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
40 kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind.: ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Iorust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Io#(error),
41 }
42 }
43 }
44
45 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<base64rust-analyzer cargo base64 0.22.1 crate/::DecodeErrorrust-analyzer cargo base64 0.22.1 decode/DecodeError#> for Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
46 fn fromrust-analyzer cargo sshkeys 0.3.4 error/impl#[Error][`From<base64::DecodeError>`]from().(error: base64rust-analyzer cargo base64 0.22.1 crate/::DecodeErrorrust-analyzer cargo base64 0.22.1 decode/DecodeError#) -> Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
47 Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
48 kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind.: ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Decoderust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Decode#(error),
49 }
50 }
51 }
52
53 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#> for Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
54 fn fromrust-analyzer cargo sshkeys 0.3.4 error/impl#[Error][`From<string::FromUtf8Error>`]from().(error: stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#) -> Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
55 Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
56 kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind.: ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Utf8Errorrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Utf8Error#(error),
57 }
58 }
59 }
60
61 impl StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
62 fn sourcerust-analyzer cargo sshkeys 0.3.4 error/impl#[Error][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
63 match self.kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind. {
64 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Iorust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Io#(ref e) => e.sourcerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error][Error]source().(),
65 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Decoderust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Decode#(ref e) => e.sourcerust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#source().(),
66 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Utf8Errorrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Utf8Error#(ref e) => e.sourcerust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#source().(),
67 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::InvalidCertTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidCertType#(_)
68 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::InvalidFormatrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidFormat#
69 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnexpectedEofrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnexpectedEof#
70 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::NotCertificaterust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#NotCertificate#
71 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::KeyTypeMismatchrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#KeyTypeMismatch#
72 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnknownCurverust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownCurve#(_)
73 | ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnknownKeyTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownKeyType#(_) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
74 }
75 }
76 }
77
78 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo sshkeys 0.3.4 error/Error# {
79 fn fmtrust-analyzer cargo sshkeys 0.3.4 error/impl#[Error][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
80 match self.kindrust-analyzer cargo sshkeys 0.3.4 error/Error#kind. {
81 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Iorust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Io#(ref err) => err.fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error][Display]fmt().(f),
82 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Decoderust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Decode#(ref err) => err.fmtrust-analyzer cargo base64 0.22.1 decode/impl#[DecodeError][Display]fmt().(f),
83 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::Utf8Errorrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#Utf8Error#(ref err) => err.fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[FromUtf8Error][Display]fmt().(f),
84 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::InvalidFormatrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidFormat# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Invalid format"),
85 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::InvalidCertTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#InvalidCertType#(v) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Invalid certificate type with value {}", v),
86 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnexpectedEofrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnexpectedEof# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Unexpected EOF reached while reading data"),
87 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnknownKeyTyperust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownKeyType#(ref v) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Unknown key type {}", v),
88 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::NotCertificaterust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#NotCertificate# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Not a certificate"),
89 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::KeyTypeMismatchrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#KeyTypeMismatch# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Key type mismatch"),
90 ErrorKindrust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#::UnknownCurverust-analyzer cargo sshkeys 0.3.4 error/ErrorKind#UnknownCurve#(ref v) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Unknown curve {}", v),
91 }
92 }
93 }