}
impl Visualization {
- pub fn decode_series(
+ fn decode_series(
&self,
locale: &'static Locale<'static>,
data: DataSources,
Ok(elements)
}
- pub fn delimited_file_source(&self) -> Option<&DelimitedFileSource> {
+ fn delimited_file_source(&self) -> Option<&DelimitedFileSource> {
self.children
.iter()
.find_map(|child| child.delimited_file_source())
}
#[derive(Clone, Debug)]
-pub struct SeriesValue {
+struct SeriesValue {
value: Datum<String>,
label: Option<String>,
}
}
#[derive(Clone)]
-pub struct Series {
+struct Series {
pub name: String,
label: Option<String>,
short_label: Option<String>,
weight: bool,
key: bool,
categorical: bool,
- pub values: Vec<SeriesValue>,
- pub unique_values: Vec<SeriesValue>,
+ values: Vec<SeriesValue>,
+ unique_values: Vec<SeriesValue>,
formatter: Formatter,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
-pub struct DelimitedFileSource {
+struct DelimitedFileSource {
/// Source name.
#[serde(rename = "@id")]
pub id: String,
#[derive(Deserialize, Debug, Default)]
#[serde(rename_all = "camelCase")]
-pub enum DelimitedFileSourceMissing {
+enum DelimitedFileSourceMissing {
#[default]
Pairwise,
}
Year,
}
-pub struct NotMdy;
+struct NotMdy;
impl TryFrom<&Item<'_>> for Mdy {
type Error = NotMdy;
}
#[derive(Copy, Clone, Debug, PartialEq)]
-pub struct Scaling {
+struct Scaling {
/// Smallest tick.
pub base: f64,
impl<'a> ExactSizeIterator for FacetIterator<'a> {}
-pub struct SemicolonSplit<'a>(Option<&'a str>);
+struct SemicolonSplit<'a>(Option<&'a str>);
impl<'a> SemicolonSplit<'a> {
fn new(s: &'a str) -> Self {
return Cow::Borrowed(self);
}
+ // Copy the input to the output, except for parsing data out of all the
+ // `embeddedSource` elements and replacing them with `userSource` stubs.
let mut data = IndexMap::new();
let mut reader = Reader::from_reader(self.xml.as_slice());
let mut writer = Writer::new(Vec::new());
}
}
- if data.is_empty() {
- Cow::Borrowed(self)
- } else {
+ if !data.is_empty() {
+ // Turn the parsed data into a `.bin` member.
Cow::Owned(crate::output::Graph {
xml: writer.into_inner(),
data: Some(DataSources(data).to_legacy_bin()),
csv: self.csv.clone(),
})
+ } else {
+ // We didn't find any `embeddedSource` elements, so stick with what
+ // we had.
+ Cow::Borrowed(self)
}
}