util/frame/audio: implement DerefMut

This commit is contained in:
meh 2015-05-28 20:16:32 +02:00
parent 82ab89d1bf
commit c1d4a1f136

View File

@ -1,6 +1,6 @@
use libc::c_int; use libc::c_int;
use std::mem; use std::mem;
use std::ops::Deref; use std::ops::{Deref, DerefMut};
use ffi::*; use ffi::*;
use ::util::format; use ::util::format;
@ -98,11 +98,17 @@ unsafe impl Send for Audio { }
impl Deref for Audio { impl Deref for Audio {
type Target = Frame; type Target = Frame;
fn deref(&self) -> &Frame { fn deref(&self) -> &<Self as Deref>::Target {
&self.0 &self.0
} }
} }
impl DerefMut for Audio {
fn deref_mut(&mut self) -> &mut<Self as Deref>::Target {
&mut self.0
}
}
impl Clone for Audio { impl Clone for Audio {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Audio(self.0.clone()) Audio(self.0.clone())