From 3ff08d747c40c2fa744483af8717173c6e97cedd Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 21 Sep 2015 09:57:35 +0200 Subject: Add GlAttributes::map_sharing --- src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 4cf9b0d..a5155f9 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 { -- cgit v1.2.3