mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Add GlAttributes::map_sharing
This commit is contained in:
parent
58b3bfb4fb
commit
3ff08d747c
14
src/lib.rs
14
src/lib.rs
|
@ -629,6 +629,20 @@ pub struct GlAttributes<S> {
|
||||||
pub vsync: bool,
|
pub vsync: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S> GlAttributes<S> {
|
||||||
|
/// Turns the `sharing` parameter into another type by calling a closure.
|
||||||
|
pub fn map_sharing<F, T>(self, f: F) -> GlAttributes<T> where F: FnOnce(S) -> T {
|
||||||
|
GlAttributes {
|
||||||
|
sharing: self.sharing.map(f),
|
||||||
|
version: self.version,
|
||||||
|
profile: self.profile,
|
||||||
|
debug: self.debug,
|
||||||
|
robustness: self.robustness,
|
||||||
|
vsync: self.vsync,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<S> Default for GlAttributes<S> {
|
impl<S> Default for GlAttributes<S> {
|
||||||
fn default() -> GlAttributes<S> {
|
fn default() -> GlAttributes<S> {
|
||||||
GlAttributes {
|
GlAttributes {
|
||||||
|
|
Loading…
Reference in a new issue