Skip to content

Commit a29f567

Browse files
committed
feat: Implement explicit feature indexes in protocols
1 parent d30127a commit a29f567

36 files changed

+1007
-74
lines changed

crates/buttplug_server/src/device/protocol_impl/galaku.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl ProtocolInitializer for GalakuInitializer {
121121
}
122122
for _ in 0..def
123123
.features()
124-
.iter()
124+
.values()
125125
.filter(|f| f.output().is_some())
126126
.count()
127127
{

crates/buttplug_server/src/device/protocol_impl/hismith_mini.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl ProtocolInitializer for HismithMiniInitializer {
8585
Ok(Arc::new(HismithMini {
8686
dual_vibe: device_definition
8787
.features()
88-
.iter()
88+
.values()
8989
.filter(|x| {
9090
x.output()
9191
.as_ref()
@@ -95,7 +95,7 @@ impl ProtocolInitializer for HismithMiniInitializer {
9595
>= 2,
9696
second_constrict: device_definition
9797
.features()
98-
.iter()
98+
.values()
9999
.position(|x| {
100100
x.output()
101101
.as_ref()

crates/buttplug_server/src/device/protocol_impl/lovehoney_desire.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl ProtocolInitializer for LovehoneyDesireInitializer {
4747
Ok(Arc::new(LovehoneyDesire::new(
4848
def
4949
.features()
50-
.iter()
50+
.values()
5151
.filter(|x| x.output().is_some())
5252
.count() as u8,
5353
)))

crates/buttplug_server/src/device/protocol_impl/lovense/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl ProtocolInitializer for LovenseInitializer {
171171

172172
let vibrator_count = device_definition
173173
.features()
174-
.iter()
174+
.values()
175175
.filter(|x| {
176176
x.output()
177177
.as_ref()
@@ -181,14 +181,14 @@ impl ProtocolInitializer for LovenseInitializer {
181181

182182
let output_count = device_definition
183183
.features()
184-
.iter()
184+
.values()
185185
.filter(|x| x.output().is_some())
186186
.count();
187187

188188
let vibrator_rotator = output_count == 2
189189
&& device_definition
190190
.features()
191-
.iter()
191+
.values()
192192
.filter(|x| {
193193
x.output()
194194
.as_ref()
@@ -198,7 +198,7 @@ impl ProtocolInitializer for LovenseInitializer {
198198
== 1
199199
&& device_definition
200200
.features()
201-
.iter()
201+
.values()
202202
.filter(|x| {
203203
x.output()
204204
.as_ref()
@@ -210,7 +210,7 @@ impl ProtocolInitializer for LovenseInitializer {
210210
let lovense_max = output_count == 2
211211
&& device_definition
212212
.features()
213-
.iter()
213+
.values()
214214
.filter(|x| {
215215
x.output()
216216
.as_ref()
@@ -220,7 +220,7 @@ impl ProtocolInitializer for LovenseInitializer {
220220
== 1
221221
&& device_definition
222222
.features()
223-
.iter()
223+
.values()
224224
.filter(|x| {
225225
x.output()
226226
.as_ref()

crates/buttplug_server/src/device/protocol_impl/magic_motion_v4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl ProtocolInitializer for MagicMotionV4Initializer {
4343
Ok(Arc::new(MagicMotionV4::new(
4444
def
4545
.features()
46-
.iter()
46+
.values()
4747
.filter(|x| x.output().is_some())
4848
.count() as u8,
4949
)))

crates/buttplug_server/src/device/protocol_impl/monsterpub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl ProtocolInitializer for MonsterPubInitializer {
137137
}
138138
let output_count = def
139139
.features()
140-
.iter()
140+
.values()
141141
.filter(|x| x.output().is_some())
142142
.count();
143143

crates/buttplug_server/src/device/protocol_impl/mysteryvibe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl ProtocolInitializer for MysteryVibeInitializer {
5555
hardware.write_value(&msg).await?;
5656
let vibrator_count = def
5757
.features()
58-
.iter()
58+
.values()
5959
.filter(|x| x.output().is_some())
6060
.count();
6161
Ok(Arc::new(MysteryVibe::new(vibrator_count as u8)))

crates/buttplug_server/src/device/protocol_impl/mysteryvibe_v2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl ProtocolInitializer for MysteryVibeV2Initializer {
5151
hardware.write_value(&msg).await?;
5252
let vibrator_count = def
5353
.features()
54-
.iter()
54+
.values()
5555
.filter(|x| x.output().is_some())
5656
.count();
5757
Ok(Arc::new(MysteryVibe::new(vibrator_count as u8)))

crates/buttplug_server/src/device/protocol_impl/satisfyer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl ProtocolInitializer for SatisfyerInitializer {
119119

120120
let feature_count = device_definition
121121
.features()
122-
.iter()
122+
.values()
123123
.filter(|x| x.output().is_some())
124124
.count();
125125

crates/buttplug_server/src/device/protocol_impl/sensee_v2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ impl ProtocolInitializer for SenseeV2Initializer {
6767
device_definition
6868
.features()
6969
.iter()
70-
.enumerate()
7170
.for_each(|(i, x)| {
7271
if let Some(output_map) = x.output()
7372
&& output_map.contains(output_type)
7473
{
75-
map.insert(i as u32, AtomicU8::new(0));
74+
map.insert(*i, AtomicU8::new(0));
7675
}
7776
});
7877
map

0 commit comments

Comments
 (0)