SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct EntropyContext<'a>(&'a String);
  2.  
  3. struct Test<'a> {
  4.     mutable_entropy: &'a mut String,
  5.     rng: String,
  6. }
  7.  
  8. impl<'a> Test<'a> {
  9.     fn new(entropy: &'a mut String, rng: String) -> Test<'a> {
  10.         Test {
  11.             mutable_entropy: entropy,
  12.             rng: rng
  13.         }
  14.     }
  15.    
  16.     fn update(&mut self, new_entropy: &str) {
  17.         self.mutable_entropy.push_str(new_entropy);
  18.     }
  19. }
  20.  
  21.  
  22. fn new_tls_random<'a>() -> Test<'a> {
  23.     let eref: &'a mut String;
  24.     let mut entropy: String = String::from("test");
  25.     eref = &mut entropy;
  26.     let rng = String::from("rng");
  27.     let test = Test::new(eref, rng);
  28.     return test;
  29. }
  30.  
  31. fn main() {
  32.     let mut c = EntropyContext();
  33.     let mut ntr = new_tls_random(&c);
  34.     ntr.update("test");
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top