1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 18:54:05 +02:00

solid is an enum

This commit is contained in:
Robin Appelman 2022-03-17 20:11:08 +01:00
commit 243d2039c3
2 changed files with 26 additions and 4 deletions

View file

@ -4,18 +4,26 @@ mod game;
use crate::data::*;
use crate::Bsp;
use std::fmt::{Debug, Formatter};
use std::ops::Deref;
/// A handle represents a data structure in the bsp file and the bsp file containing it.
///
/// Keeping a reference of the bsp file with the data is required since a lot of data types
/// reference parts from other structures in the bsp file
#[derive(Debug)]
pub struct Handle<'a, T> {
bsp: &'a Bsp,
data: &'a T,
}
impl<T: Debug> Debug for Handle<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Handle")
.field("data", self.data)
.finish_non_exhaustive()
}
}
impl<T> Clone for Handle<'_, T> {
fn clone(&self) -> Self {
Handle { ..*self }