tangled
alpha
login
or
join now
buttplug.io
/
buttplug
20
fork
atom
Buttplug sex toy control library
20
fork
atom
overview
issues
pulls
pipelines
chore: Fix new config structures to load json properly
qdot.tngl.sh
6 months ago
b7d86b9f
1f295167
+17
-2
2 changed files
expand all
collapse all
unified
split
crates
buttplug_server_device_config
src
device_config_file
device.rs
protocol.rs
+16
-1
crates/buttplug_server_device_config/src/device_config_file/device.rs
···
9
9
#[derive(Debug, Clone, Getters, CopyGetters, Serialize, Deserialize)]
10
10
pub struct ConfigBaseDeviceDefinition {
11
11
#[getset(get = "pub")]
12
12
+
identifier: Option<Vec<String>>,
13
13
+
#[getset(get = "pub")]
12
14
/// Given name of the device this instance represents.
13
15
name: String,
14
16
#[getset(get_copy = "pub")]
···
18
20
#[getset(get_copy = "pub")]
19
21
message_gap_ms: Option<u32>,
20
22
#[getset(get = "pub")]
21
21
-
features: Vec<ConfigBaseDeviceFeature>,
23
23
+
features: Option<Vec<ConfigBaseDeviceFeature>>,
24
24
+
}
25
25
+
26
26
+
impl ConfigBaseDeviceDefinition {
27
27
+
pub fn update_with_configuration(&self, config: ConfigBaseDeviceDefinition) -> Self {
28
28
+
Self {
29
29
+
identifier: config.identifier().clone(),
30
30
+
name: config.name().clone(),
31
31
+
id: config.id(),
32
32
+
protocol_variant: config.protocol_variant.or(self.protocol_variant.clone()),
33
33
+
message_gap_ms: config.message_gap_ms.or(self.message_gap_ms),
34
34
+
features: config.features.or(self.features.clone())
35
35
+
}
36
36
+
}
22
37
}
23
38
24
39
impl Into<ServerDeviceDefinition> for ConfigBaseDeviceDefinition {
+1
-1
crates/buttplug_server_device_config/src/device_config_file/protocol.rs
···
15
15
#[serde(skip_serializing_if = "Option::is_none")]
16
16
pub defaults: Option<ConfigBaseDeviceDefinition>,
17
17
#[serde(default)]
18
18
-
pub configurations: HashMap<String, ConfigBaseDeviceDefinition>,
18
18
+
pub configurations: Vec<ConfigBaseDeviceDefinition>,
19
19
}