pub enum ControlFieldValue<'a> {
Simple(Cow<'a, str>),
Folded(Cow<'a, str>),
Multiline(Cow<'a, str>),
}Expand description
A field value in a control file.
This represents the value after the colon (:) in field definitions.
There are canonically 3 types of field values: simple, folded, and multiline. The differences between folded and multiline are semantic. folded is logically a single line spanning multiple formatted lines and whitespace is not significant. multiline has similar syntax as folded but whitespace is significant.
Variants§
Implementations§
Source§impl<'a> ControlFieldValue<'a>
impl<'a> ControlFieldValue<'a>
Sourcepub fn iter_lines(&self) -> Box<dyn Iterator<Item = &str> + '_>
pub fn iter_lines(&self) -> Box<dyn Iterator<Item = &str> + '_>
Obtain an iterator over string values in this field.
Self::Simple variants will emit a single item.
Self::Folded and Self::Multiline may emit multiple items.
For variants stored as multiple lines, leading whitespace will be trimmed, as necessary.
Sourcepub fn iter_words(&self) -> Box<dyn Iterator<Item = &str> + '_>
pub fn iter_words(&self) -> Box<dyn Iterator<Item = &str> + '_>
Obtain an iterator over words in the string value.
The result may be non-meaningful for multiple line variants.
Sourcepub fn into_inner(self) -> Cow<'a, str>
pub fn into_inner(self) -> Cow<'a, str>
Obtain the inner string backing this value and consume this instance.
Sourcepub fn to_control_field(self, name: Cow<'a, str>) -> ControlField<'a>
pub fn to_control_field(self, name: Cow<'a, str>) -> ControlField<'a>
Convert this strongly typed value into a ControlField.
Trait Implementations§
Source§impl<'a> Clone for ControlFieldValue<'a>
impl<'a> Clone for ControlFieldValue<'a>
Source§fn clone(&self) -> ControlFieldValue<'a>
fn clone(&self) -> ControlFieldValue<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for ControlFieldValue<'a>
impl<'a> Debug for ControlFieldValue<'a>
Source§impl<'a> Hash for ControlFieldValue<'a>
impl<'a> Hash for ControlFieldValue<'a>
Source§impl<'a> Ord for ControlFieldValue<'a>
impl<'a> Ord for ControlFieldValue<'a>
Source§fn cmp(&self, other: &ControlFieldValue<'a>) -> Ordering
fn cmp(&self, other: &ControlFieldValue<'a>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialEq for ControlFieldValue<'a>
impl<'a> PartialEq for ControlFieldValue<'a>
Source§impl<'a> PartialOrd for ControlFieldValue<'a>
impl<'a> PartialOrd for ControlFieldValue<'a>
impl<'a> Eq for ControlFieldValue<'a>
impl<'a> StructuralPartialEq for ControlFieldValue<'a>
Auto Trait Implementations§
impl<'a> Freeze for ControlFieldValue<'a>
impl<'a> RefUnwindSafe for ControlFieldValue<'a>
impl<'a> Send for ControlFieldValue<'a>
impl<'a> Sync for ControlFieldValue<'a>
impl<'a> Unpin for ControlFieldValue<'a>
impl<'a> UnwindSafe for ControlFieldValue<'a>
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> Comparable<K> for Q
impl<Q, K> Comparable<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.