summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-04-23 03:04:25 +0200
committerHampusM <hampus@hampusmat.com>2026-04-23 03:04:25 +0200
commit7699a1f498dd41d9abfc907d36e37dfed7a761c0 (patch)
tree2cd9fa31031b8a8470a69ef6cffa115a54ba5f83
parent0b99ad032ed63253aa3f534bcf8eee39a12c0388 (diff)
refactor(opengl-bindings): change Error enum into struct MakeContextCurrentError
-rw-r--r--opengl-bindings/src/lib.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/opengl-bindings/src/lib.rs b/opengl-bindings/src/lib.rs
index e5051d5..cfdfa35 100644
--- a/opengl-bindings/src/lib.rs
+++ b/opengl-bindings/src/lib.rs
@@ -31,11 +31,11 @@ impl ContextWithFns
pub fn new<SurfaceType: SurfaceTypeTrait>(
context: NotCurrentContext,
surface: &Surface<SurfaceType>,
- ) -> Result<Self, Error>
+ ) -> Result<Self, MakeContextCurrentError>
{
let context = context
.make_current(surface)
- .map_err(Error::MakeContextCurrentFailed)?;
+ .map_err(MakeContextCurrentError)?;
let display = context.display();
@@ -58,12 +58,12 @@ impl ContextWithFns
pub fn make_current<SurfaceType: SurfaceTypeTrait>(
&self,
surface: &Surface<SurfaceType>,
- ) -> Result<CurrentContextWithFns<'_>, Error>
+ ) -> Result<CurrentContextWithFns<'_>, MakeContextCurrentError>
{
if !self.context.is_current() || !surface.is_current(&self.context) {
self.context
.make_current(surface)
- .map_err(Error::MakeContextCurrentFailed)?;
+ .map_err(MakeContextCurrentError)?;
}
Ok(CurrentContextWithFns { ctx: self })
@@ -97,11 +97,8 @@ impl CurrentContextWithFns<'_>
}
#[derive(Debug, thiserror::Error)]
-pub enum Error
-{
- #[error("Failed to make context current")]
- MakeContextCurrentFailed(#[source] glutin::error::Error),
-}
+#[error("Failed to make context current")]
+pub struct MakeContextCurrentError(#[source] glutin::error::Error);
mod sys
{