space_traders_api/models/
ship_module.rs

1/*
2 * SpaceTraders API
3 *
4 * SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe.  The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server.  ```json http {   \"method\": \"GET\",   \"url\": \"https://api.spacetraders.io/v2\", } ```  Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community.  We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players.   
5 *
6 * The version of the OpenAPI document: 2.3.0
7 * Contact: joel@spacetraders.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ShipModule : A module can be installed in a ship and provides a set of capabilities such as storage space or quarters for crew. Module installations are permanent.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ShipModule {
17    /// The symbol of the module.
18    #[serde(rename = "symbol")]
19    pub symbol: Symbol,
20    /// Modules that provide capacity, such as cargo hold or crew quarters will show this value to denote how much of a bonus the module grants.
21    #[serde(rename = "capacity", skip_serializing_if = "Option::is_none")]
22    pub capacity: Option<i32>,
23    /// Modules that have a range will such as a sensor array show this value to denote how far can the module reach with its capabilities.
24    #[serde(rename = "range", skip_serializing_if = "Option::is_none")]
25    pub range: Option<i32>,
26    /// Name of this module.
27    #[serde(rename = "name")]
28    pub name: String,
29    /// Description of this module.
30    #[serde(rename = "description")]
31    pub description: String,
32    #[serde(rename = "requirements")]
33    pub requirements: Box<models::ShipRequirements>,
34}
35
36impl ShipModule {
37    /// A module can be installed in a ship and provides a set of capabilities such as storage space or quarters for crew. Module installations are permanent.
38    pub fn new(symbol: Symbol, name: String, description: String, requirements: models::ShipRequirements) -> ShipModule {
39        ShipModule {
40            symbol,
41            capacity: None,
42            range: None,
43            name,
44            description,
45            requirements: Box::new(requirements),
46        }
47    }
48}
49/// The symbol of the module.
50#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
51pub enum Symbol {
52    #[serde(rename = "MODULE_MINERAL_PROCESSOR_I")]
53    ModuleMineralProcessorI,
54    #[serde(rename = "MODULE_GAS_PROCESSOR_I")]
55    ModuleGasProcessorI,
56    #[serde(rename = "MODULE_CARGO_HOLD_I")]
57    ModuleCargoHoldI,
58    #[serde(rename = "MODULE_CARGO_HOLD_II")]
59    ModuleCargoHoldIi,
60    #[serde(rename = "MODULE_CARGO_HOLD_III")]
61    ModuleCargoHoldIii,
62    #[serde(rename = "MODULE_CREW_QUARTERS_I")]
63    ModuleCrewQuartersI,
64    #[serde(rename = "MODULE_ENVOY_QUARTERS_I")]
65    ModuleEnvoyQuartersI,
66    #[serde(rename = "MODULE_PASSENGER_CABIN_I")]
67    ModulePassengerCabinI,
68    #[serde(rename = "MODULE_MICRO_REFINERY_I")]
69    ModuleMicroRefineryI,
70    #[serde(rename = "MODULE_ORE_REFINERY_I")]
71    ModuleOreRefineryI,
72    #[serde(rename = "MODULE_FUEL_REFINERY_I")]
73    ModuleFuelRefineryI,
74    #[serde(rename = "MODULE_SCIENCE_LAB_I")]
75    ModuleScienceLabI,
76    #[serde(rename = "MODULE_JUMP_DRIVE_I")]
77    ModuleJumpDriveI,
78    #[serde(rename = "MODULE_JUMP_DRIVE_II")]
79    ModuleJumpDriveIi,
80    #[serde(rename = "MODULE_JUMP_DRIVE_III")]
81    ModuleJumpDriveIii,
82    #[serde(rename = "MODULE_WARP_DRIVE_I")]
83    ModuleWarpDriveI,
84    #[serde(rename = "MODULE_WARP_DRIVE_II")]
85    ModuleWarpDriveIi,
86    #[serde(rename = "MODULE_WARP_DRIVE_III")]
87    ModuleWarpDriveIii,
88    #[serde(rename = "MODULE_SHIELD_GENERATOR_I")]
89    ModuleShieldGeneratorI,
90    #[serde(rename = "MODULE_SHIELD_GENERATOR_II")]
91    ModuleShieldGeneratorIi,
92}
93
94impl Default for Symbol {
95    fn default() -> Symbol {
96        Self::ModuleMineralProcessorI
97    }
98}
99