dimas_commands/messages/
about_entity.rs1#![allow(clippy::non_canonical_partial_ord_impl)]
3
4#[doc(hidden)]
7extern crate alloc;
8
9use alloc::string::String;
11use bitcode::{Decode, Encode};
12use core::fmt::Display;
13use dimas_core::enums::OperationState;
14#[repr(C)]
19#[derive(Encode, Clone, Decode)]
20pub struct AboutEntity {
21 name: String,
22 kind: String,
23 zid: String,
24 state: OperationState,
25}
26
27impl Display for AboutEntity {
28 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
29 write!(
30 f,
31 "name: {} kind: {} state: {} zid: {}",
32 &self.name, &self.kind, &self.state, &self.zid
33 )
34 }
35}
36
37impl AboutEntity {
38 #[must_use]
40 pub const fn new(name: String, kind: String, zid: String, state: OperationState) -> Self {
41 Self {
42 name,
43 kind,
44 zid,
45 state,
46 }
47 }
48
49 #[must_use]
51 pub fn name(&self) -> &str {
52 &self.name
53 }
54
55 #[must_use]
57 pub fn kind(&self) -> &str {
58 &self.kind
59 }
60
61 #[must_use]
63 pub fn zid(&self) -> &str {
64 &self.zid
65 }
66
67 #[must_use]
69 pub const fn state(&self) -> &OperationState {
70 &self.state
71 }
72}
73