dimas_commands/messages/
scouting_entity.rs1#![allow(clippy::non_canonical_partial_ord_impl)]
3
4#[doc(hidden)]
7extern crate alloc;
8
9#[cfg(feature = "std")]
10extern crate std;
11
12use alloc::{string::String, vec::Vec};
14use bitcode::{Decode, Encode};
15use core::fmt::Display;
16#[repr(C)]
21#[derive(Encode, Clone, Decode)]
22pub struct ScoutingEntity {
23 zid: String,
24 kind: String,
25 locators: Vec<String>,
26}
27
28impl Display for ScoutingEntity {
29 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
30 f.debug_struct("ScoutingEntity")
31 .field("zid", &self.zid)
32 .field("kind", &self.kind)
33 .field("locators", &self.locators)
34 .finish()
35 }
36}
37
38impl ScoutingEntity {
39 #[must_use]
41 pub const fn new(zid: String, kind: String, locators: Vec<String>) -> Self {
42 Self {
43 zid,
44 kind,
45 locators,
46 }
47 }
48
49 #[must_use]
51 pub fn zid(&self) -> &str {
52 &self.zid
53 }
54
55 #[must_use]
57 pub fn kind(&self) -> &str {
58 &self.kind
59 }
60
61 #[must_use]
63 pub const fn locators(&self) -> &Vec<String> {
64 &self.locators
65 }
66}
67