aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {