1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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) } }