Advertisement
Guest User

lifetimes

a guest
Mar 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.37 KB | None | 0 0
  1. struct BufferAndSound<'a> {
  2.    buffer: Rc<SoundBuffer>,
  3.    sound : Sound<'a>,
  4. }
  5.  
  6. impl<'a> BufferAndSound<'a> {
  7.     fn new() -> Self {
  8.         let buffer = Rc::new(SoundBuffer::from_file("some_audio.wav").unwrap());
  9.         let sound = Sound::with_buffer(&buffer);
  10.  
  11.         BufferAndSound {
  12.             buffer: buffer,
  13.             sound: sound
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement