rytm_rs/query/
settings.rs

1use super::ObjectQuery;
2use crate::sysex::{AnySysexType, SysexType};
3
4#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
5/// A query to retrieve a [`Settings`](crate::object::Settings) object from rytm.
6pub struct SettingsQuery {
7    sysex_type: SysexType,
8    device_id: u8,
9}
10
11impl SettingsQuery {
12    /// Creates a new settings query.
13    #[allow(clippy::new_without_default)]
14    pub const fn new() -> Self {
15        Self {
16            sysex_type: SysexType::Settings,
17            device_id: 0,
18        }
19    }
20
21    /// Creates a new settings query with a device id.
22    pub const fn new_with_device_id(device_id: u8) -> Self {
23        Self {
24            sysex_type: SysexType::Settings,
25            device_id,
26        }
27    }
28}
29
30impl ObjectQuery for SettingsQuery {
31    fn sysex_type(&self) -> AnySysexType {
32        self.sysex_type.into()
33    }
34
35    fn device_id(&self) -> u8 {
36        self.device_id
37    }
38
39    fn obj_nr(&self) -> u16 {
40        0x0000
41    }
42}