fdf_component/node/
properties.rsuse fidl_fuchsia_driver_framework::{NodePropertyKey, NodePropertyValue};
pub struct PropertyKey(pub(crate) NodePropertyKey);
impl From<String> for PropertyKey {
fn from(value: String) -> Self {
Self(NodePropertyKey::StringValue(value))
}
}
impl From<&str> for PropertyKey {
fn from(value: &str) -> Self {
Self(NodePropertyKey::StringValue(value.to_owned()))
}
}
impl From<u32> for PropertyKey {
fn from(value: u32) -> Self {
Self(NodePropertyKey::IntValue(value))
}
}
impl PropertyKey {
pub fn from_string(value: impl Into<String>) -> Self {
String::into(value.into())
}
pub fn from_int(value: impl Into<u32>) -> Self {
u32::into(value.into())
}
}
pub struct PropertyValue(pub(crate) NodePropertyValue);
impl From<String> for PropertyValue {
fn from(value: String) -> Self {
Self(NodePropertyValue::StringValue(value))
}
}
impl From<&str> for PropertyValue {
fn from(value: &str) -> Self {
Self(NodePropertyValue::StringValue(value.to_owned()))
}
}
impl From<u32> for PropertyValue {
fn from(value: u32) -> Self {
Self(NodePropertyValue::IntValue(value))
}
}
impl From<bool> for PropertyValue {
fn from(value: bool) -> Self {
Self(NodePropertyValue::BoolValue(value))
}
}
impl PropertyValue {
pub fn from_string(value: impl Into<String>) -> Self {
String::into(value.into())
}
pub fn from_int(value: impl Into<u32>) -> Self {
u32::into(value.into())
}
pub fn from_bool(value: impl Into<bool>) -> Self {
bool::into(value.into())
}
}