rust: Matching structopt instructions and the use of Rust values after transfer

We will be able to fit on decide.cmd to decide which Command
variants was once known as. This we could us specify the variants
as fit standards and likewise destructure the values out
to make use of them.

 let decide = Decide::from_args(); dbg!(&decide); fit decide.cmd { Command::Write { name } => todo!(), }(*11*)

As written, we run into two problems with this code.
One is that we are not the use of name but. In
destructuring, we will use the placeholder (_) in our
trend.

caution: unused variable: `name` --> src/major.rs:32:26 |
32 | Command::Write { name } => todo!(), | ^^^^^ lend a hand: take a look at ignoring the sector: `name: _` | = notice: `#[warn(unused_variables)]` on via default
(*11*)

fn major() -> Outcome<()> { color_eyre::set up()?; let decide = Decide::from_args(); dbg!(decide); fit decide.cmd { Command::Write { name: _ } => todo!(), }
}
(*11*)

The second one factor is that the decide variable is moved
prior to we attempt to destructure it. If we have a look at the
compiler output prior to we fastened the name factor we
see the price use after transfer pointing at name
in particular.

error[E0382]: use of moved worth
m --> src/major.rs:32:26 |
29 | let decide = Decide::from_args(); | --- transfer happens as a result of `decide` has sort `Decide`, which doesn't put in force the `Replica` trait
30 | dbg!(decide); | ---------- worth moved right here
31 | fit decide.cmd {
32 | Command::Write { name } => todo!(), | ^^^^^ worth used right here after transfer
(*11*)

If we have a look at it after solving the unused name,
we see the compiler level at decide.cmd.

error[E0382]: use of moved worth: `decide.cmd` --> src/major.rs:31:11 |
29 | let decide = Decide::from_args(); | --- transfer happens as a result of `decide` has sort `Decide`, which doesn't put in force the `Replica` trait
30 | dbg!(decide); | ---------- worth moved right here
31 | fit decide.cmd { | ^^^^^^^ worth used right here after transfer
(*11*)

It's because decide is moved into the dbg name as a result of
it does not put in force the Replica trait. Now, shall we
put in force or derive Replica for Decide if Command can
put in force Replica, however we will no longer put in force Replica for
Command. It's because String does no longer, and cannot,
put in force Replica, and we now have a String in our name.

With out diving into the depths of Replica, Clone,
and allocation, there's something we now have that already
implements Replica, so we do not wish to.

Shared references put in force Replica.

So as an alternative of passing decide into dbg!, and thus the use of
transfer semantics (which can be the default in Rust), we will
cross a shared reference in: dgb!(&decide) which we could us
use reproduction semantics.

The variation between transfer semantics and replica semantics
on this case is that we will get entry to decide after passing it
to dbg!.

Beneath the hood, each a replica and a transfer may end up in bits
being copied in reminiscence, even though that is on occasion
optimized away. -- Replica

fn major() -> Outcome<()> { let decide = Decide::from_args(); dbg!(&decide); fit decide.cmd { Command::Write { name: _ } => todo!(), }
}
(*11*)