Debian Codegraph @

src/error.rs

raw symbols SCIP
1 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{
2 fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#},
3 numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError# as StdParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#,
4 };
5
6 /// The error type returned when when parsing an integer fails.
7 #[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:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
8 pub struct ParseIntErrorrust-analyzer cargo js_int 0.2.2 error/ParseIntError# {
9 pub(craterust-analyzer cargo js_int 0.2.2 crate/) kindrust-analyzer cargo js_int 0.2.2 error/ParseIntError#kind.: ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#,
10 }
11
12 // When https://github.com/rust-lang/rust/issues/22639 is resolved, the error kind can be provided
13 // publicly as well. For now, distinguishing between overflow / underflow and anything else doesn't
14 // seem very useful.
15 #[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:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
16 pub(craterust-analyzer cargo js_int 0.2.2 crate/) enum ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind# {
17 Overflowrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Overflow#,
18 Underflowrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Underflow#,
19 Unknownrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Unknown#(StdParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#),
20 }
21
22 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<StdParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#> for ParseIntErrorrust-analyzer cargo js_int 0.2.2 error/ParseIntError# {
23 fn fromrust-analyzer cargo js_int 0.2.2 error/impl#[ParseIntError][`From<StdParseIntError>`]from().(e: StdParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#) -> Selfrust-analyzer cargo js_int 0.2.2 error/impl#[ParseIntError][`From<StdParseIntError>`] {
24 ParseIntErrorrust-analyzer cargo js_int 0.2.2 error/ParseIntError# { kindrust-analyzer cargo js_int 0.2.2 error/ParseIntError#kind.: ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#::Unknownrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Unknown#(e) }
25 }
26 }
27
28 impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ParseIntErrorrust-analyzer cargo js_int 0.2.2 error/ParseIntError# {
29 fn fmtrust-analyzer cargo js_int 0.2.2 error/impl#[ParseIntError][Display]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
30 match &self.kindrust-analyzer cargo js_int 0.2.2 error/ParseIntError#kind. {
31 ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#::Overflowrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Overflow# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number too large to fit in target type"),
32 ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#::Underflowrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Underflow# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number too small to fit in target type"),
33 ParseIntErrorKindrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#::Unknownrust-analyzer cargo js_int 0.2.2 error/ParseIntErrorKind#Unknown#(e) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", e),
34 }
35 }
36 }
37
38 #[cfg(feature = "std")]
39 impl 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# for ParseIntErrorrust-analyzer cargo js_int 0.2.2 error/ParseIntError# {}
40
41 /// The error type returned when a checked integral type conversion fails.
42 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
43 pub struct TryFromIntErrorrust-analyzer cargo js_int 0.2.2 error/TryFromIntError# {
44 _privaterust-analyzer cargo js_int 0.2.2 error/TryFromIntError#_private.: (),
45 }
46
47 impl TryFromIntErrorrust-analyzer cargo js_int 0.2.2 error/TryFromIntError# {
48 pub(craterust-analyzer cargo js_int 0.2.2 crate/) fn newrust-analyzer cargo js_int 0.2.2 error/impl#[TryFromIntError]new().() -> Selfrust-analyzer cargo js_int 0.2.2 error/impl#[TryFromIntError] {
49 Selfrust-analyzer cargo js_int 0.2.2 error/impl#[TryFromIntError] { _privaterust-analyzer cargo js_int 0.2.2 error/TryFromIntError#_private.: () }
50 }
51 }
52
53 impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for TryFromIntErrorrust-analyzer cargo js_int 0.2.2 error/TryFromIntError# {
54 fn fmtrust-analyzer cargo js_int 0.2.2 error/impl#[TryFromIntError][Display]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
55 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("out of range integral type conversion attempted")
56 }
57 }
58
59 impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for TryFromIntErrorrust-analyzer cargo js_int 0.2.2 error/TryFromIntError# {
60 fn fmtrust-analyzer cargo js_int 0.2.2 error/impl#[TryFromIntError][Debug]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
61 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("TryFromIntError")
62 }
63 }
64
65 #[cfg(feature = "std")]
66 impl 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# for TryFromIntErrorrust-analyzer cargo js_int 0.2.2 error/TryFromIntError# {}