marble-machinations/src/level.rs

49 lines
718 B
Rust
Raw Normal View History

2024-10-06 12:39:36 +02:00
use serde::Deserialize;
2024-10-06 16:00:12 +02:00
#[derive(Debug, Clone, Deserialize)]
2024-10-06 12:39:36 +02:00
pub struct Level {
id: String,
sort_order: i32,
2024-10-06 12:39:36 +02:00
name: String,
description: String,
#[serde(default)]
is_sandbox: bool,
2024-10-06 12:39:36 +02:00
init_board: Option<String>,
inputs: Vec<u8>,
outputs: Vec<u8>,
}
impl Level {
pub fn id(&self) -> &str {
&self.id
}
pub fn sort_order(&self) -> i32 {
self.sort_order
}
2024-10-06 12:39:36 +02:00
pub fn name(&self) -> &str {
&self.name
}
pub fn description(&self) -> &str {
&self.description
}
pub fn is_sandbox(&self) -> bool {
self.is_sandbox
}
pub fn init_board(&self) -> Option<String> {
2024-10-06 16:00:12 +02:00
self.init_board.clone()
2024-10-06 12:39:36 +02:00
}
pub fn inputs(&self) -> &[u8] {
&self.inputs
}
pub fn outputs(&self) -> &[u8] {
&self.outputs
}
}