tamer: ir::xir: Add missing docs for QName, Prefix, LocalName

The docs still need to be improved, but they can be touched as we go.

This concludes the initial development of XIR.  That was much more involved
that I had originally intended, but the result is good.

DEV-10561
main
Mike Gerwitz 2021-10-11 11:56:03 -04:00
parent bc5091d2a7
commit 68397f1413
1 changed files with 13 additions and 0 deletions

View File

@ -43,7 +43,13 @@ pub mod pred;
pub mod tree;
pub mod writer;
/// A static symbol that can be safely converted into a [`QName`] without
/// any checks.
///
/// This must only be implemented on static symbol types that are known to
/// be valid QNames.
pub trait QNameCompatibleStaticSymbolId: StaticSymbolId {}
impl QNameCompatibleStaticSymbolId for CIdentStaticSymbolId {}
impl QNameCompatibleStaticSymbolId for TameIdentStaticSymbolId {}
@ -154,8 +160,11 @@ impl TryFrom<&str> for NCName {
}
}
/// Namespace prefix of a [`QName`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Prefix(NCName);
/// Local name portion of a [`QName`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct LocalPart(NCName);
@ -203,6 +212,10 @@ impl TryFrom<&str> for LocalPart {
}
}
/// A sequence of one or more whitespace characters.
///
/// Whitespace here is expected to consist of `[ \n\t\r]`
/// (where the first character in that class is a space).
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Whitespace(SymbolId);