Skip to content

Commit 745c2d4

Browse files
authored
Merge pull request #6 from kpreid/asref
Add `impl AsRef<W> for GraphicsContext<W>`.
2 parents 1745323 + 3529b20 commit 745c2d4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ impl<W: HasRawWindowHandle> GraphicsContext<W> {
122122
}
123123
}
124124

125+
impl<W: HasRawWindowHandle> AsRef<W> for GraphicsContext<W> {
126+
/// Equivalent to [`self.window()`](Self::window()).
127+
#[inline]
128+
fn as_ref(&self) -> &W {
129+
self.window()
130+
}
131+
}
132+
125133
trait GraphicsContextImpl {
126134
unsafe fn set_buffer(&mut self, buffer: &[u32], width: u16, height: u16);
127135
}

0 commit comments

Comments
 (0)