Buttplug sex toy control library
at dev 950 B view raw
1// Buttplug Rust Source Code File - See https://buttplug.io for more info. 2// 3// Copyright 2016-2024 Nonpolynomial Labs LLC. All rights reserved. 4// 5// Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6// for full license information. 7 8use crate::message::{ 9 ButtplugMessage, 10 ButtplugMessageError, 11 ButtplugMessageFinalizer, 12 ButtplugMessageValidator, 13}; 14use serde::{Deserialize, Serialize}; 15#[derive( 16 Debug, ButtplugMessage, ButtplugMessageFinalizer, Clone, PartialEq, Eq, Serialize, Deserialize, 17)] 18pub struct PingV0 { 19 /// Message Id, used for matching message pairs in remote connection instances. 20 #[serde(rename = "Id")] 21 id: u32, 22} 23 24impl Default for PingV0 { 25 /// Creates a new Ping message with the given Id. 26 fn default() -> Self { 27 Self { id: 1 } 28 } 29} 30 31impl ButtplugMessageValidator for PingV0 { 32 fn is_valid(&self) -> Result<(), ButtplugMessageError> { 33 self.is_not_system_id(self.id) 34 } 35}