From 12f48046b2606fc77a1312a6d5e5fc7ff9feff88 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 13 Oct 2023 23:32:00 +0200 Subject: refactor(engine): move uses of OpenGL to OpenGL module --- engine/src/opengl/currently_bound.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 engine/src/opengl/currently_bound.rs (limited to 'engine/src/opengl/currently_bound.rs') diff --git a/engine/src/opengl/currently_bound.rs b/engine/src/opengl/currently_bound.rs new file mode 100644 index 0000000..eefa239 --- /dev/null +++ b/engine/src/opengl/currently_bound.rs @@ -0,0 +1,22 @@ +use std::marker::PhantomData; + +/// A token signifying a OpenGL object is currently bound. +pub struct CurrentlyBound<'token, Object> +{ + _token: PhantomData<&'token Object>, +} + +impl<'token, Object> CurrentlyBound<'token, Object> +{ + /// Returns a new `CurrentlyBound`. + /// + /// # Safety + /// A object must actually be currently bound. Otherwise, UB can occur. + #[must_use] + pub unsafe fn new() -> Self + { + Self { + _token: PhantomData, + } + } +} -- cgit v1.2.3-18-g5258