pub struct Paragraph(/* private fields */);Expand description
An AST node representing a Paragraph.
Implementations§
Source§impl Paragraph
impl Paragraph
Sourcepub fn wrap_and_sort(
&self,
indentation: Indentation,
immediate_empty_line: bool,
max_line_length_one_liner: Option<usize>,
sort_entries: Option<&dyn Fn(&Entry, &Entry) -> Ordering>,
format_value: Option<&dyn Fn(&str, &str) -> String>,
) -> Paragraph
pub fn wrap_and_sort( &self, indentation: Indentation, immediate_empty_line: bool, max_line_length_one_liner: Option<usize>, sort_entries: Option<&dyn Fn(&Entry, &Entry) -> Ordering>, format_value: Option<&dyn Fn(&str, &str) -> String>, ) -> Paragraph
Reformat this paragraph
§Arguments
indentation- The indentation to useimmediate_empty_line- Whether multi-line values should always start with an empty linemax_line_length_one_liner- If set, then this is the max length of the value if it is crammed into a “one-liner” valuesort_entries- If set, then this function will sort the entries according to the given functionformat_value- If set, then this function will format the value according to the given function
Sourcepub fn get(&self, key: &str) -> Option<String>
pub fn get(&self, key: &str) -> Option<String>
Returns the value of the given key in the paragraph.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns whether the paragraph contains the given key.
Sourcepub fn entries(&self) -> impl Iterator<Item = Entry> + '_
pub fn entries(&self) -> impl Iterator<Item = Entry> + '_
Returns an iterator over all entries in the paragraph.
Sourcepub fn items(&self) -> impl Iterator<Item = (String, String)> + '_
pub fn items(&self) -> impl Iterator<Item = (String, String)> + '_
Returns an iterator over all items in the paragraph.
Sourcepub fn get_all<'a>(&'a self, key: &'a str) -> impl Iterator<Item = String> + 'a
pub fn get_all<'a>(&'a self, key: &'a str) -> impl Iterator<Item = String> + 'a
Returns an iterator over all values for the given key in the paragraph.
Trait Implementations§
Source§impl FromIterator<Paragraph> for Deb822
impl FromIterator<Paragraph> for Deb822
impl Eq for Paragraph
impl StructuralPartialEq for Paragraph
Auto Trait Implementations§
impl Freeze for Paragraph
impl !RefUnwindSafe for Paragraph
impl !Send for Paragraph
impl !Sync for Paragraph
impl Unpin for Paragraph
impl !UnwindSafe for Paragraph
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
Mutably borrows from an owned value. Read more