pub struct NonBlankString(/* private fields */);Expand description
A source string that holds at least one non-whitespace character.
A selection id, an external document identity and a native name are read back and compared as text. A run of spaces names nothing, so it is refused here rather than by each reader.
Implementations§
Source§impl NonBlankString
impl NonBlankString
Sourcepub fn new(value: impl Into<String>) -> Option<Self>
pub fn new(value: impl Into<String>) -> Option<Self>
Constructs a source string that is not blank.
Absent when the value holds no non-whitespace character, the empty string included.
Sourcepub fn prefixed(prefix: NonWhitespaceChar, suffix: impl Display) -> Self
pub fn prefixed(prefix: NonWhitespaceChar, suffix: impl Display) -> Self
Constructs a non-blank string from a leading character and a suffix.
Total: the prefix is non-whitespace, so the result holds it whatever the suffix renders to.
Sourcepub fn with_suffix(&self, suffix: &str) -> Self
pub fn with_suffix(&self, suffix: &str) -> Self
Append text while retaining the admitted non-whitespace character.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the value and returns the source string.
Trait Implementations§
Source§impl Borrow<str> for NonBlankString
Lookup by the plain string the key spells.
impl Borrow<str> for NonBlankString
Lookup by the plain string the key spells.
Ord and Hash are derived over the same String, so a map keyed by this
type answers get, contains_key and indexing with a &str and orders its
keys exactly as a String key would.