Make Palette::add_namespace public

This commit is contained in:
Alexandre Bury 2018-06-10 23:35:31 -07:00
parent 8acc08f340
commit 9569e991bf

View File

@ -32,10 +32,16 @@ pub struct Palette {
/// A node in the palette tree. /// A node in the palette tree.
/// ///
/// This describes a value attached to a custom keyword in the palette.
///
/// This can either be a color, or a nested namespace with its own mapping. /// This can either be a color, or a nested namespace with its own mapping.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
enum PaletteNode { pub enum PaletteNode {
/// A single color.
Color(Color), Color(Color),
/// A group of values bundled in the same namespace.
///
/// Namespaces can be merged in the palette with `Palette::merge`.
Namespace(HashMap<String, PaletteNode>), Namespace(HashMap<String, PaletteNode>),
} }
@ -117,7 +123,7 @@ impl Palette {
} }
/// Adds a color namespace to this palette. /// Adds a color namespace to this palette.
fn add_namespace( pub fn add_namespace(
&mut self, key: &str, namespace: HashMap<String, PaletteNode>, &mut self, key: &str, namespace: HashMap<String, PaletteNode>,
) { ) {
self.custom self.custom