use std::ops::Range;
#[cfg(feature = "input-toml")]
use super::toml_entries;
#[cfg(feature = "input-yaml")]
use super::yaml_entries;
use super::{Format, Input, InputError};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Written {
Plain,
SingleQuoted,
DoubleQuoted,
Literal,
Folded,
MultilineBasic,
MultilineLiteral,
Alias,
Collection,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct Entry {
pub key: String,
pub value: Range<usize>,
pub written: Written,
pub string: Option<String>,
}
impl Input {
pub fn top_level(&self) -> Result<Vec<Entry>, InputError> {
match self.format {
#[cfg(feature = "input-yaml")]
Format::Yaml => yaml_entries::entries(self),
#[cfg(feature = "input-toml")]
Format::Toml => toml_entries::entries(self),
}
}
}