From 68397f1413dd4c4366d090230d5aa39451d93a80 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 11 Oct 2021 11:56:03 -0400 Subject: [PATCH] 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 --- tamer/src/ir/xir.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tamer/src/ir/xir.rs b/tamer/src/ir/xir.rs index b52b70b5..8cc27914 100644 --- a/tamer/src/ir/xir.rs +++ b/tamer/src/ir/xir.rs @@ -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);