use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};
#[derive(Debug, Clone, PartialEq, Eq, ArrowField, ArrowSerialize, ArrowDeserialize)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[arrow_field(transparent)]
pub struct Label(pub String);
impl Label {
#[inline]
pub fn as_str(&self) -> &str {
self.0.as_str()
}
}
impl re_log_types::LegacyComponent for Label {
#[inline]
fn legacy_name() -> re_log_types::ComponentName {
"rerun.label".into()
}
}
impl From<String> for Label {
#[inline]
fn from(value: String) -> Self {
Self(value)
}
}
impl From<Label> for String {
#[inline]
fn from(value: Label) -> Self {
value.0
}
}
impl AsRef<str> for Label {
#[inline]
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::borrow::Borrow<str> for Label {
#[inline]
fn borrow(&self) -> &str {
self.as_str()
}
}
impl std::ops::Deref for Label {
type Target = str;
#[inline]
fn deref(&self) -> &str {
self.as_str()
}
}
re_log_types::component_legacy_shim!(Label);