re_viewer 0.8.0-alpha.7

The Rerun viewer
Documentation
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};

/// A Panel component
///
/// ## Example
/// ```
/// # use re_viewer::blueprint_components::panel::PanelState;
/// # use arrow2_convert::field::ArrowField;
/// # use arrow2::datatypes::{DataType, Field};
/// assert_eq!(
///     PanelState::data_type(),
///     DataType::Struct(vec![
///         Field::new("expanded", DataType::Boolean, false),
///     ])
/// );
/// ```
// TODO(jleibs): If we want these accessible from python, they need to
// go into the registry that's back in `re_log_types`
#[derive(Debug, Clone, Copy, ArrowField, ArrowSerialize, ArrowDeserialize)]
pub struct PanelState {
    pub expanded: bool,
}

impl PanelState {
    // TODO(jleibs): Would be nice if this could be a const EntityPath but making
    // the hash const is a bit of a pain.
    pub const BLUEPRINT_VIEW_PATH: &str = "blueprint_view";
    pub const SELECTION_VIEW_PATH: &str = "selection_view";
    pub const TIMELINE_VIEW_PATH: &str = "timeline_view";
}

impl re_log_types::LegacyComponent for PanelState {
    #[inline]
    fn legacy_name() -> re_log_types::ComponentName {
        "rerun.blueprint.panel_view".into()
    }
}

re_log_types::component_legacy_shim!(PanelState);