pub struct Reader {
pub problems: Vec<Problem>,
pub refs: Vec<Found<Ref>>,
pub tags: Vec<Found<Ref>>,
pub resources: Vec<Found<Res>>,
/* private fields */
}Expand description
The state of reading a value: where it is, the problems so far, and the references met (for the build to check against the content there is).
Fields§
§problems: Vec<Problem>§refs: Vec<Found<Ref>>§resources: Vec<Found<Res>>Implementations§
Source§impl Reader
impl Reader
pub fn new() -> Self
pub fn path(&self) -> &Path
Sourcepub fn problem(&mut self, message: impl Into<String>)
pub fn problem(&mut self, message: impl Into<String>)
Reports a problem with the value being read.
pub fn note_ref(&mut self, r: Ref)
pub fn note_tag(&mut self, r: Ref)
pub fn note_res(&mut self, r: Res)
Sourcepub fn unknown_keys(&mut self, map: &Map, known: &[&str])
pub fn unknown_keys(&mut self, map: &Map, known: &[&str])
Reports keys of map that aren’t known (nor metadata, nor allowed by an enclosing enum).
Sourcepub fn unknown_name(&mut self, name: &str, known: &[&str])
pub fn unknown_name(&mut self, name: &str, known: &[&str])
Reports a name that isn’t one of known (an enum’s variant).
Sourcepub fn field<T: Schema>(&mut self, map: &Map, key: &'static str) -> Option<T>
pub fn field<T: Schema>(&mut self, map: &Map, key: &'static str) -> Option<T>
Field key of map: read, or its absent value, or a problem.
Sourcepub fn field_or<T: Schema>(
&mut self,
map: &Map,
key: &'static str,
default: impl FnOnce() -> T,
) -> Option<T>
pub fn field_or<T: Schema>( &mut self, map: &Map, key: &'static str, default: impl FnOnce() -> T, ) -> Option<T>
Field key of map, default() when it isn’t there.
Sourcepub fn with_allowed<T>(
&mut self,
key: &'static str,
f: impl FnOnce(&mut Self) -> T,
) -> T
pub fn with_allowed<T>( &mut self, key: &'static str, f: impl FnOnce(&mut Self) -> T, ) -> T
Reads v as T with key allowed in it — the tag of the enum variant T is.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnsafeUnpin for Reader
impl UnwindSafe for Reader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more