2024-01-20 12:42:20 -08:00

65 lines
1.8 KiB
Rust

//! This module defines lightweight handles for every content type.
//! This isn't strictly necessary (we could refer to them using their string keys),
//! but this approach doesn't require frequent string cloning, and
//! gives each content type a distinct Rust type.
//!
//! We could also use raw references to content types, but that creates a mess of lifetimes
//! in our code. It's managable, but the approach here is simpler and easier to understand.
use std::{cmp::Eq, hash::Hash};
/// A lightweight representation of a sprite
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SpriteHandle {
pub(crate) index: usize,
}
/// A lightweight representation of system body
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SystemObjectHandle {
/// TODO: pub in crate
pub system_handle: SystemHandle,
/// The index of this object in system.objects
pub body_index: usize,
}
/// A lightweight representation of an outfit
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct OutfitHandle {
/// TODO: pub in crate, currently for debug (same with all other handles)
pub index: usize,
}
/// A lightweight representation of a gun
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct GunHandle {
/// TODO
pub index: usize,
}
/// A lightweight representation of a ship
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ShipHandle {
/// TODO
pub index: usize,
}
/// A lightweight representation of a star system
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SystemHandle {
/// TODO
pub index: usize,
}
/// A lightweight representation of a faction
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FactionHandle {
/// TODO
pub index: usize,
}
/// A lightweight representation of an effect
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct EffectHandle {
pub(crate) index: usize,
}