gh-pages
MarcoIeni 3 years ago
parent 8591bc66fe
commit f50fe26f0e

@ -187,7 +187,7 @@ different names, but there can only be one <code>Default</code> implementation p
<pre><pre class="playground"><code class="language-rust edition2018">use std::{path::PathBuf, time::Duration};
// note that we can simply auto-derive Default here.
#[derive(Default, Debug)]
#[derive(Default, Debug, PartialEq)]
struct MyConfiguration {
// Option defaults to None
output: Option&lt;PathBuf&gt;,
@ -209,6 +209,13 @@ fn main() {
// do something with conf here
conf.check = true;
println!(&quot;conf = {:#?}&quot;, conf);
// partial initalization with default values, creates the same instance
let conf1 = MyConfiguration {
check: true,
..Default::default()
};
assert_eq!(conf, conf1);
}
</code></pre></pre>
<h2 id="see-also"><a class="header" href="#see-also">See also</a></h2>

@ -402,7 +402,7 @@ different names, but there can only be one <code>Default</code> implementation p
<pre><pre class="playground"><code class="language-rust edition2018">use std::{path::PathBuf, time::Duration};
// note that we can simply auto-derive Default here.
#[derive(Default, Debug)]
#[derive(Default, Debug, PartialEq)]
struct MyConfiguration {
// Option defaults to None
output: Option&lt;PathBuf&gt;,
@ -424,6 +424,13 @@ fn main() {
// do something with conf here
conf.check = true;
println!(&quot;conf = {:#?}&quot;, conf);
// partial initalization with default values, creates the same instance
let conf1 = MyConfiguration {
check: true,
..Default::default()
};
assert_eq!(conf, conf1);
}
</code></pre></pre>
<h2 id="see-also-2"><a class="header" href="#see-also-2">See also</a></h2>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save