diff --git a/src/sdl2/rect.rs b/src/sdl2/rect.rs index 86aab74c..e0db90bb 100644 --- a/src/sdl2/rect.rs +++ b/src/sdl2/rect.rs @@ -5,6 +5,7 @@ use sys::rect as ll; use std::mem; use std::ptr; use std::ops::{Deref, Add, BitAnd, BitOr, Div, Mul, Neg, Sub}; +use std::convert::{AsRef, AsMut}; /// The maximal integer value that can be used for rectangles. /// @@ -450,6 +451,18 @@ impl From<(i32, i32, u32, u32)> for Rect { } } +impl AsRef for Rect { + fn as_ref(&self) -> &ll::SDL_Rect { + &self.raw + } +} + +impl AsMut for Rect { + fn as_mut(&mut self) -> &mut ll::SDL_Rect { + &mut self.raw + } +} + // Intersection impl BitAnd for Rect { type Output = Option;