Skip to content

Commit 3f65de7

Browse files
committed
add From to example in lib.rs
1 parent ace6d60 commit 3f65de7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ pub struct PublicStruct {
2525
impl PublicStruct {
2626
pub fn new() -> Self {
2727
Self {
28-
inner: DebugIgnore(InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ })
28+
// DebugIgnore<T> has a `From<T>` impl for the inner type; you can also construct
29+
// one explicitly.
30+
inner: InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ }.into(),
2931
}
3032
}
3133
}

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
//! impl PublicStruct {
2525
//! pub fn new() -> Self {
2626
//! Self {
27-
//! inner: DebugIgnore(InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ })
27+
//! // DebugIgnore<T> has a `From<T>` impl for the inner type; you can also construct
28+
//! // one explicitly.
29+
//! inner: InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ }.into(),
2830
//! }
2931
//! }
3032
//! }

0 commit comments

Comments
 (0)