diff --git a/src/lib.rs b/src/lib.rs index 4cf9b0d2..a5155f9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -629,6 +629,20 @@ pub struct GlAttributes { pub vsync: bool, } +impl GlAttributes { + /// Turns the `sharing` parameter into another type by calling a closure. + pub fn map_sharing(self, f: F) -> GlAttributes 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 Default for GlAttributes { fn default() -> GlAttributes { GlAttributes {