diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-13 22:55:56 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-13 22:55:56 +0200 |
commit | cfa73b1ea42fa491ff9e00bb5efb5e5a5d860578 (patch) | |
tree | 95af08ec7e9598daef6a740ce3494c4e0f1c645d /engine/src/currently_bound.rs | |
parent | 25b5ca97c5e5597570360c37d7452662e0118a00 (diff) |
refactor(engine): add OpenGL object currently bound guards
Diffstat (limited to 'engine/src/currently_bound.rs')
-rw-r--r-- | engine/src/currently_bound.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/engine/src/currently_bound.rs b/engine/src/currently_bound.rs new file mode 100644 index 0000000..eefa239 --- /dev/null +++ b/engine/src/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, + } + } +} |