oc2_hlapi/
types.rs

1use serde::{Deserialize, Serialize};
2
3/// Information associated with an imported file, containing the file's name and size in bytes.
4#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
5pub struct ImportFileInfo {
6    /// The file's name.
7    pub name: Box<str>,
8    /// The file's size in bytes.
9    pub size: u64,
10}
11
12/// A description of a device or interface block.
13#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
14#[serde(rename_all = "camelCase")]
15pub struct DeviceDescriptor {
16    /// The device's UUID.
17    pub device_id: uuid::Uuid,
18    /// A list of strings that determine which kind of device the UUID refers to.
19    pub type_names: Box<[Box<str>]>,
20}
21
22/// An RPC method signature and description.
23#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
24#[serde(rename_all = "camelCase")]
25pub struct MethodDescriptor {
26    /// The method's name.
27    pub name: Box<str>,
28    /// The method's return type.
29    pub return_type: Box<str>,
30    /// Documentation about what the method does.
31    pub description: Box<str>,
32    /// A list of method parameters.
33    pub parameters: Box<[ParameterDescriptor]>,
34}
35
36/// A description of one of a method's parameters, including the method name, description, and type.
37#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
38pub struct ParameterDescriptor {
39    /// The parameter's name.
40    pub name: Box<str>,
41    /// Documentation about what the parameter is used for.
42    pub description: Box<str>,
43    #[serde(rename = "type")]
44    /// The parameter's type.
45    pub ty: Box<str>,
46}
47
48/// A block's relative direction.
49#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
50#[serde(rename_all = "lowercase")]
51pub enum Direction {
52    Up,
53    Down,
54    Front,
55    Back,
56    Left,
57    Right,
58}
59
60/// A rotation direction.
61#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
62#[serde(rename_all = "lowercase")]
63pub enum RotationDirection {
64    Left,
65    Right,
66}
67
68/// The state of a robot's current action.
69#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
70pub enum RobotActionResult {
71    Incomplete,
72    Success,
73    Failure,
74}