summaryrefslogtreecommitdiff
path: root/engine/src/util.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-25 20:48:39 +0200
committerHampusM <hampus@hampusmat.com>2024-05-01 19:18:03 +0200
commit9530d22cf5369ceba369487fff1b85376da64657 (patch)
tree5beeaa594e77a32877336e119035197e8cd5ac9d /engine/src/util.rs
parent33f7772ddddf2a1c2bfefc50ef39f123df8af3e4 (diff)
feat(engine): add basic Wavefront obj file parsing
Diffstat (limited to 'engine/src/util.rs')
-rw-r--r--engine/src/util.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/engine/src/util.rs b/engine/src/util.rs
new file mode 100644
index 0000000..021b2fe
--- /dev/null
+++ b/engine/src/util.rs
@@ -0,0 +1,24 @@
+macro_rules! try_option {
+ ($expr: expr) => {
+ match $expr {
+ Ok(value) => value,
+ Err(err) => {
+ return Some(Err(err));
+ }
+ }
+ };
+}
+
+pub(crate) use try_option;
+
+macro_rules! or {
+ (($($tt: tt)+) else ($($else_tt: tt)*)) => {
+ $($tt)+
+ };
+
+ (() else ($($else_tt: tt)*)) => {
+ $($else_tt)*
+ };
+}
+
+pub(crate) use or;