Add impl AsRef<W> for GraphicsContext<W>.
This will allow code which works with windows generically (such as an event loop which can work with `softbuffer` or another graphics library) to be able to access the underlying window without knowing about `softbuffer` in particular.
This commit is contained in:
parent
08883d76c5
commit
cfbde6073c
1 changed files with 7 additions and 0 deletions
|
|
@ -109,6 +109,13 @@ impl<W: HasRawWindowHandle> GraphicsContext<W> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<W: HasRawWindowHandle> AsRef<W> for GraphicsContext<W> {
|
||||||
|
/// Equivalent to [`self.window()`](Self::window()).
|
||||||
|
fn as_ref(&self) -> &W {
|
||||||
|
self.window()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait GraphicsContextImpl {
|
trait GraphicsContextImpl {
|
||||||
unsafe fn set_buffer(&mut self, buffer: &[u32], width: u16, height: u16);
|
unsafe fn set_buffer(&mut self, buffer: &[u32], width: u16, height: u16);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue