diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-09-21 09:57:35 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-09-21 12:03:56 +0200 |
commit | 3ff08d747c40c2fa744483af8717173c6e97cedd (patch) | |
tree | 4c31a5c2499e146f3bfc93b7340ea64996985bd2 /src | |
parent | 58b3bfb4fba22ecdb6f846f88f8a74e13ecae8ec (diff) | |
download | glutin-3ff08d747c40c2fa744483af8717173c6e97cedd.tar.gz glutin-3ff08d747c40c2fa744483af8717173c6e97cedd.zip |
Add GlAttributes::map_sharing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -629,6 +629,20 @@ pub struct GlAttributes<S> { 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> { fn default() -> GlAttributes<S> { GlAttributes { |