pub struct Dialect {
pub namespace: &'static str,
pub region: Option<&'static str>,
pub trailer: Option<&'static str>,
pub scheme: Option<&'static str>,
}Expand description
How a host spells the markers the parser recognises. The engine’s own
markers are <ns>:only, <ns>:guidance and <ns>:optional; a host
may add one region, one trailer and one reference scheme.
Fields§
§namespace: &'static strThe namespace every marker is written in, as host.
region: Option<&'static str>The host’s region: <!-- <ns>:<region> target --> to
<!-- /<ns>:<region> -->, masked as one opaque block, as include.
trailer: Option<&'static str>The host’s trailer: <!-- <ns>:<trailer> -->, the generated block
of reference definitions that ends a document, as links.
scheme: Option<&'static str>The host’s reference scheme: a link label <scheme>:<rest> is a
reference the host resolves, as host.
Implementations§
Source§impl Dialect
impl Dialect
Sourcepub fn marker(&self, line: &str) -> Option<Marker>
pub fn marker(&self, line: &str) -> Option<Marker>
Recognise a region or trailer marker line. Whitespace inside the comment is free; the line carries nothing else.
Sourcepub fn is_only_marker(&self, line: &str) -> bool
pub fn is_only_marker(&self, line: &str) -> bool
Whether a line is an only marker of grammar example, as an HTML
comment or a YAML comment.
Sourcepub fn is_guidance_marker(&self, line: &str) -> bool
pub fn is_guidance_marker(&self, line: &str) -> bool
Whether a line is a guidance marker: one HTML comment line, or one
YAML comment line, whose text starts <ns>:guidance. A scaffold
writes one before the part it guides; a governed document that keeps
one still has that part to write.
Sourcepub fn is_optional_marker(&self, line: &str) -> bool
pub fn is_optional_marker(&self, line: &str) -> bool
Whether a line opens an optional region: what lies between it and
its close is a part the schema does not demand, so a reader of the
scaffold keeps the part and drops the markers, or drops both. The
region is written open and closed, because its reader is a person
and nothing else tells them where it ends.
Sourcepub fn is_optional_close(&self, line: &str) -> bool
pub fn is_optional_close(&self, line: &str) -> bool
Whether a line closes an optional region.
Sourcepub fn is_optional_mark(&self, line: &str) -> bool
pub fn is_optional_mark(&self, line: &str) -> bool
Whether a line is either end of an optional region.
Sourcepub fn only_marker(&self, line: &str) -> Option<Condition>
pub fn only_marker(&self, line: &str) -> Option<Condition>
Parse an only k=v,v2 k2=v | k3=v marker line into its condition:
each map, dimension to states, with the maps joined by |. None
when the line is no marker or is malformed.
Trait Implementations§
impl Copy for Dialect
impl Eq for Dialect
impl StructuralPartialEq for Dialect
Auto Trait Implementations§
impl Forget for Dialect
impl Freeze for Dialect
impl Move for Dialect
impl RefUnwindSafe for Dialect
impl Send for Dialect
impl Sync for Dialect
impl Unpin for Dialect
impl UnsafeUnpin for Dialect
impl UnwindSafe for Dialect
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.