Debian Codegraph @

tests/readme.rs

raw symbols SCIP
1 #![allow(missing_docs, dead_code, clippy::from_over_into)]
2
3 struct MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
4
5 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_as_refrust-analyzer cargo impl-more 0.3.1 as_ref/impl_as_ref!!(MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct# => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
6 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_as_mutrust-analyzer cargo impl-more 0.3.1 as_ref/impl_as_mut!!(MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct# => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
7
8 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_derefrust-analyzer cargo impl-more 0.3.1 deref/impl_deref!!(MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct# => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
9 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_deref_mutrust-analyzer cargo impl-more 0.3.1 deref/impl_deref_mut!!(MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct#);
10 // or, to deref through String too:
11 // impl_more::forward_deref_and_mut!(MyNewTypeStruct, ref str);
12
13 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_fromrust-analyzer cargo impl-more 0.3.1 from/impl_from!!(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# => MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct#);
14 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_intorust-analyzer cargo impl-more 0.3.1 from/impl_into!!(MyNewTypeStructrust-analyzer cargo impl-more 0.3.1 MyNewTypeStruct# => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
15
16 enum MyEnumrust-analyzer cargo impl-more 0.3.1 MyEnum# {
17 Barrust-analyzer cargo impl-more 0.3.1 MyEnum#Bar#,
18 Quxrust-analyzer cargo impl-more 0.3.1 MyEnum#Qux#,
19 }
20
21 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_display_enumrust-analyzer cargo impl-more 0.3.1 display/impl_display_enum!!(MyEnumrust-analyzer cargo impl-more 0.3.1 MyEnum#: Barrust-analyzer cargo impl-more 0.3.1 MyEnum#Bar# => "bar", Quxrust-analyzer cargo impl-more 0.3.1 MyEnum#Qux# => "qux");
22
23 enum Coordsrust-analyzer cargo impl-more 0.3.1 Coords# {
24 Xyrust-analyzer cargo impl-more 0.3.1 Coords#Xy#(i64, i64),
25 Xyzrust-analyzer cargo impl-more 0.3.1 Coords#Xyz#(i64, i64, i64),
26 Uvrust-analyzer cargo impl-more 0.3.1 Coords#Uv#(i64, i64),
27 }
28
29 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_display_enumrust-analyzer cargo impl-more 0.3.1 display/impl_display_enum!!(
30 Coordsrust-analyzer cargo impl-more 0.3.1 Coords#:
31 Xyrust-analyzer cargo impl-more 0.3.1 Coords#Xy#(x, y) => "{x}, {y}",
32 Xyzrust-analyzer cargo impl-more 0.3.1 Coords#Xyz#(x, y, z) => "{x}, {y}, {z}",
33 Uvrust-analyzer cargo impl-more 0.3.1 Coords#Uv#(u, _) => "{u}",
34 );
35
36 #[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:)]
37 enum Errrust-analyzer cargo impl-more 0.3.1 Err# {
38 Iorust-analyzer cargo impl-more 0.3.1 Err#Io#(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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#),
39 Genericrust-analyzer cargo impl-more 0.3.1 Err#Generic#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
40 }
41
42 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_display_enumrust-analyzer cargo impl-more 0.3.1 display/impl_display_enum!! {
43 Errrust-analyzer cargo impl-more 0.3.1 Err#:
44 Iorust-analyzer cargo impl-more 0.3.1 Err#Io#(err) => "{err}",
45 Genericrust-analyzer cargo impl-more 0.3.1 Err#Generic#(msg) => "{msg}",
46 }
47 #[rustversionrust-analyzer cargo rustversion 1.0.22 crate/::sincerust-analyzer cargo rustversion 1.0.22 since:(1.81)]
48 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::impl_error_enumrust-analyzer cargo impl-more 0.3.1 error/impl_error_enum!!(Errrust-analyzer cargo impl-more 0.3.1 Err#: Iorust-analyzer cargo impl-more 0.3.1 Err#Io#(err) => err);
49
50 #[rustversionrust-analyzer cargo rustversion 1.0.22 crate/::sincerust-analyzer cargo rustversion 1.0.22 since:(1.81)]
51 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
52 fn forward_error_newtyperust-analyzer cargo impl-more 0.3.1 forward_error_newtype().() {
53 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 _;
54
55 #[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:)]
56 struct MyErrorrust-analyzer cargo impl-more 0.3.1 MyError#(eyrerust-analyzer cargo eyre 0.6.12 crate/::Reportrust-analyzer cargo eyre 0.6.12 Report#);
57
58 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::forward_displayrust-analyzer cargo impl-more 0.3.1 display/forward_display!!(MyErrorrust-analyzer cargo impl-more 0.3.1 MyError#);
59 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::forward_errorrust-analyzer cargo impl-more 0.3.1 error/forward_error!!(MyErrorrust-analyzer cargo impl-more 0.3.1 MyError#);
60
61 let err = MyErrorrust-analyzer cargo impl-more 0.3.1 MyError#(eyrerust-analyzer cargo eyre 0.6.12 crate/::eyrerust-analyzer cargo eyre 0.6.12 macros/eyre!!("something went wrong"));
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(err.sourcerust-analyzer cargo impl-more 0.3.1 impl#[MyError][Error]source().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "something went wrong");
63 }
64
65 #[rustversionrust-analyzer cargo rustversion 1.0.22 crate/::sincerust-analyzer cargo rustversion 1.0.22 since:(1.81)]
66 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
67 fn forward_error_fieldrust-analyzer cargo impl-more 0.3.1 forward_error_field().() {
68 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 _;
69
70 #[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:)]
71 struct MyErrorrust-analyzer cargo impl-more 0.3.1 MyError# {
72 causerust-analyzer cargo impl-more 0.3.1 MyError#cause.: eyrerust-analyzer cargo eyre 0.6.12 crate/::Reportrust-analyzer cargo eyre 0.6.12 Report#,
73 }
74
75 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::forward_displayrust-analyzer cargo impl-more 0.3.1 display/forward_display!!(MyErrorrust-analyzer cargo impl-more 0.3.1 MyError# => causerust-analyzer cargo impl-more 0.3.1 MyError#cause.);
76 impl_morerust-analyzer cargo impl-more 0.3.1 crate/::forward_errorrust-analyzer cargo impl-more 0.3.1 error/forward_error!!(MyErrorrust-analyzer cargo impl-more 0.3.1 MyError# => causerust-analyzer cargo impl-more 0.3.1 MyError#cause.);
77
78 let err = MyErrorrust-analyzer cargo impl-more 0.3.1 MyError# {
79 causerust-analyzer cargo impl-more 0.3.1 MyError#cause.: eyrerust-analyzer cargo eyre 0.6.12 crate/::eyrerust-analyzer cargo eyre 0.6.12 macros/eyre!!("something went wrong"),
80 };
81 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(err.sourcerust-analyzer cargo impl-more 0.3.1 impl#[MyError][Error]source().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "something went wrong");
82 }