Merge pull request #6 from kpreid/asref

Add `impl AsRef<W> for GraphicsContext<W>`.
This commit is contained in:
David Johnson 2022-08-23 21:03:59 -05:00 committed by GitHub
commit 745c2d44dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,6 +122,14 @@ impl<W: HasRawWindowHandle> GraphicsContext<W> {
}
}
impl<W: HasRawWindowHandle> AsRef<W> for GraphicsContext<W> {
/// Equivalent to [`self.window()`](Self::window()).
#[inline]
fn as_ref(&self) -> &W {
self.window()
}
}
trait GraphicsContextImpl {
unsafe fn set_buffer(&mut self, buffer: &[u32], width: u16, height: u16);
}