1#[derive(Copy, Clone, Debug, PartialEq, Eq)]
8pub struct BusCapabilities {
9 pub supports_fd: bool,
11 pub max_payload_len: u8,
13}
14
15impl BusCapabilities {
16 pub const fn classical() -> Self {
18 Self {
19 supports_fd: false,
20 max_payload_len: 8,
21 }
22 }
23
24 pub const fn fd() -> Self {
26 Self {
27 supports_fd: true,
28 max_payload_len: 64,
29 }
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[test]
38 fn classical_constants() {
39 let c = BusCapabilities::classical();
40 assert!(!c.supports_fd);
41 assert_eq!(c.max_payload_len, 8);
42 }
43
44 #[test]
45 fn fd_constants() {
46 let c = BusCapabilities::fd();
47 assert!(c.supports_fd);
48 assert_eq!(c.max_payload_len, 64);
49 }
50}