.map(AsRef::as_ref)
}
- // TODO: Why is this `pub`?
pub fn values(&self) -> CargoResult<&HashMap<String, ConfigValue>> {
self.values.try_borrow_with(|| self.load_values())
}
}
}
- // TODO: why is this pub?
- pub fn expected<T>(&self, ty: &str, key: &str, val: CV) -> CargoResult<T> {
+ fn expected<T>(&self, ty: &str, key: &str, val: CV) -> CargoResult<T> {
val.expected(ty, key)
.map_err(|e| format_err!("invalid configuration for key `{}`\n{}", key, e))
}
!self.frozen && !self.locked
}
- // TODO: this was pub for RLS but may not be needed anymore?
/// Loads configuration from the filesystem
pub fn load_values(&self) -> CargoResult<HashMap<String, ConfigValue>> {
let mut cfg = CV::Table(HashMap::new(), PathBuf::from("."));
where
V: de::DeserializeSeed<'de>,
{
- // TODO: Is it safe to assume next_value_seed is always called
- // (exactly once) after next_key_seed?
let next_key = self.next.take().expect("next field missing");
let next_key = self.key.join(next_key);
seed.deserialize(Deserializer {
}
}
- pub fn expected<T>(&self, wanted: &str, key: &str) -> CargoResult<T> {
+ fn expected<T>(&self, wanted: &str, key: &str) -> CargoResult<T> {
bail!(
"expected a {}, but found a {} for `{}` in {}",
wanted,