title: How to get a value from a Result?
body: <p>How can I get the value of a <code>struct</code> which is returned in a <code>Result</code> from another function? Example below.</p>
  <pre><code>#[derive(Debug)]
  pub struct Keypair(ed25519_dalek::Keypair);
  
  pub fn keypair_from_seed(seed: &amp;[u8]) -&gt; Result&lt;Keypair, Box&lt;dyn error::Error&gt;&gt; {
      let dalek_keypair = ed25519_dalek::Keypair { secret, public };
      Ok(Keypair(dalek_keypair))
  }
  </code></pre>
  <pre><code>fn main(){
    //here seed_bytes is mnemonics
    let sk = keypair_from_seed(&amp;seed_bytes);
    //sk contains the secret key and public key, i want to extract it different secret key &amp; public key
  }
  </code></pre>