use {NodeIndex, WidgetId};
/// An index either given in the form of a publicly instantiated `Widget`'s `WidgetId`, or an
/// internally instantiated `Widget`'s `NodeIndex`,
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Index {
/// A public identifier given by a user of a conrod library/widget, usually generated by the
/// `widget_ids` macro.
Public(WidgetId),
/// An index to an internal widget, usually used to construct some other widget.
Internal(NodeIndex),
}
impl From<WidgetId> for Index {
fn from(id: WidgetId) -> Index {
Index::Public(id)
}
}
impl From<NodeIndex> for Index {
fn from(idx: NodeIndex) -> Index {
Index::Internal(idx)
}
}