fdf_component/node/
properties.rs1use fidl_fuchsia_driver_framework::{NodePropertyKey, NodePropertyValue};
6
7pub struct PropertyKey(pub(crate) NodePropertyKey);
10
11impl From<String> for PropertyKey {
12 fn from(value: String) -> Self {
13 Self(NodePropertyKey::StringValue(value))
14 }
15}
16
17impl From<&str> for PropertyKey {
18 fn from(value: &str) -> Self {
19 Self(NodePropertyKey::StringValue(value.to_owned()))
20 }
21}
22
23impl From<u32> for PropertyKey {
24 fn from(value: u32) -> Self {
25 Self(NodePropertyKey::IntValue(value))
26 }
27}
28
29impl PropertyKey {
30 pub fn from_string(value: impl Into<String>) -> Self {
32 String::into(value.into())
33 }
34
35 pub fn from_int(value: impl Into<u32>) -> Self {
37 u32::into(value.into())
38 }
39}
40
41pub struct PropertyValue(pub(crate) NodePropertyValue);
44
45impl From<String> for PropertyValue {
46 fn from(value: String) -> Self {
47 Self(NodePropertyValue::StringValue(value))
48 }
49}
50
51impl From<&str> for PropertyValue {
52 fn from(value: &str) -> Self {
53 Self(NodePropertyValue::StringValue(value.to_owned()))
54 }
55}
56
57impl From<u32> for PropertyValue {
58 fn from(value: u32) -> Self {
59 Self(NodePropertyValue::IntValue(value))
60 }
61}
62
63impl From<bool> for PropertyValue {
64 fn from(value: bool) -> Self {
65 Self(NodePropertyValue::BoolValue(value))
66 }
67}
68
69impl PropertyValue {
70 pub fn from_string(value: impl Into<String>) -> Self {
72 String::into(value.into())
73 }
74
75 pub fn from_int(value: impl Into<u32>) -> Self {
77 u32::into(value.into())
78 }
79
80 pub fn from_bool(value: impl Into<bool>) -> Self {
82 bool::into(value.into())
83 }
84}