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§fn eq(&self, other: &ControlFieldValue<'a>) -> bool
fn eq(&self, other: &ControlFieldValue<'a>) -> bool
self and other values to be equal, and is used
by ==.source§impl<'a> PartialOrd for ControlFieldValue<'a>
impl<'a> PartialOrd for ControlFieldValue<'a>
source§fn partial_cmp(&self, other: &ControlFieldValue<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &ControlFieldValue<'a>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl<'a> Eq for ControlFieldValue<'a>
impl<'a> StructuralEq for ControlFieldValue<'a>
impl<'a> StructuralPartialEq for ControlFieldValue<'a>
Auto Trait Implementations§
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.