aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 09:57:35 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 12:03:56 +0200
commit3ff08d747c40c2fa744483af8717173c6e97cedd (patch)
tree4c31a5c2499e146f3bfc93b7340ea64996985bd2 /src/lib.rs
parent58b3bfb4fba22ecdb6f846f88f8a74e13ecae8ec (diff)
downloadglutin-3ff08d747c40c2fa744483af8717173c6e97cedd.tar.gz
glutin-3ff08d747c40c2fa744483af8717173c6e97cedd.zip
Add GlAttributes::map_sharing
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 14 insertions, 0 deletions
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<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 {