pub struct ControlField<'a> { /* private fields */ }Expand description
A field in a control file.
Implementations§
Source§impl<'a> ControlField<'a>
impl<'a> ControlField<'a>
Sourcepub fn new(name: Cow<'a, str>, value: Cow<'a, str>) -> Self
pub fn new(name: Cow<'a, str>, value: Cow<'a, str>) -> Self
Construct an instance from a field name and value.
Sourcepub fn from_lines(
name: Cow<'a, str>,
lines: impl Iterator<Item = String>,
) -> Self
pub fn from_lines( name: Cow<'a, str>, lines: impl Iterator<Item = String>, ) -> Self
Construct an instance from an iterable of lines.
Each line should not have leading whitespace.
Sourcepub fn value_str(&self) -> &str
pub fn value_str(&self) -> &str
Obtain the value as a &str.
The value’s original file formatting (including newlines and leading whitespace) is included.
Sourcepub fn as_simple(&self) -> Result<ControlFieldValue<'a>>
pub fn as_simple(&self) -> Result<ControlFieldValue<'a>>
Obtain the value as a ControlFieldValue::Simple if possible.
This will fail if the tracked value has multiple lines.
Sourcepub fn as_folded(&self) -> ControlFieldValue<'a>
pub fn as_folded(&self) -> ControlFieldValue<'a>
Obtain the value as a ControlFieldValue::Folded.
Sourcepub fn as_multiline(&self) -> ControlFieldValue<'a>
pub fn as_multiline(&self) -> ControlFieldValue<'a>
Obtain the value as a ControlFieldValue::Multiline.
Sourcepub fn iter_words(&self) -> Box<dyn Iterator<Item = &str> + '_>
pub fn iter_words(&self) -> Box<dyn Iterator<Item = &str> + '_>
Obtain an iterator of words in the value.
Sourcepub fn iter_lines(&self) -> Box<dyn Iterator<Item = &str> + '_>
pub fn iter_lines(&self) -> Box<dyn Iterator<Item = &str> + '_>
Obtain an iterator of lines in the value.
Leading whitespace from each line is stripped.
Sourcepub fn iter_comma_delimited(&self) -> Box<dyn Iterator<Item = &str> + '_>
pub fn iter_comma_delimited(&self) -> Box<dyn Iterator<Item = &str> + '_>
Obtain an iterator of comma delimited values in the value.
Whitespace surrounding the comma is trimmed.
Trait Implementations§
Source§impl<'a> Clone for ControlField<'a>
impl<'a> Clone for ControlField<'a>
Source§fn clone(&self) -> ControlField<'a>
fn clone(&self) -> ControlField<'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 ControlField<'a>
impl<'a> Debug for ControlField<'a>
Source§impl<'a> Display for ControlField<'a>
impl<'a> Display for ControlField<'a>
Source§impl<'a> Hash for ControlField<'a>
impl<'a> Hash for ControlField<'a>
Source§impl<'a> Ord for ControlField<'a>
impl<'a> Ord for ControlField<'a>
Source§fn cmp(&self, other: &ControlField<'a>) -> Ordering
fn cmp(&self, other: &ControlField<'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 ControlField<'a>
impl<'a> PartialEq for ControlField<'a>
Source§impl<'a> PartialOrd for ControlField<'a>
impl<'a> PartialOrd for ControlField<'a>
impl<'a> Eq for ControlField<'a>
impl<'a> StructuralPartialEq for ControlField<'a>
Auto Trait Implementations§
impl<'a> Freeze for ControlField<'a>
impl<'a> RefUnwindSafe for ControlField<'a>
impl<'a> Send for ControlField<'a>
impl<'a> Sync for ControlField<'a>
impl<'a> Unpin for ControlField<'a>
impl<'a> UnwindSafe for ControlField<'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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.