Skip to main content

binpack_3d/
bin.rs

1use serde::{
2    Deserialize,
3    Serialize,
4};
5
6use crate::vector::Vector3;
7
8/// The Bin to the placed into
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct Bin {
11    /// Primary Key
12    pub id: i32,
13    /// The Position of a Item
14    pub position: Vector3<u32>,
15    /// Weight
16    pub max_weight: u32,
17    /// The weight bin has now
18    pub weight_currently: u32,
19}
20impl Bin {
21    /// Default Constructor
22    pub const fn new(
23        id: i32,
24        position: Vector3<u32>,
25        max_weight: u32,
26        weight_currently: u32,
27    ) -> Self {
28        Self {
29            id,
30            position,
31            max_weight,
32            weight_currently,
33        }
34    }
35}
36/// Gives for a Bin Space back
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct SpaceLeftBin(pub u32);
39impl SpaceLeftBin {
40    /// Default Constructor
41    pub const fn new(input: u32) -> Self {
42        Self(input)
43    }
44}