pub struct Paragraph {
pub fields: Vec<Field>,
}Expand description
A deb822 paragraph.
Fields§
§fields: Vec<Field>Fields in the paragraph.
Implementations§
Source§impl Paragraph
impl Paragraph
Sourcepub fn get(&self, name: &str) -> Option<&str>
pub fn get(&self, name: &str) -> Option<&str>
Get the value of a field by name.
Field names are compared case-insensitively.
Returns None if the field does not exist.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
Iterate over the fields in the paragraph.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (&str, &mut String)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&str, &mut String)>
Iterate over the fields in the paragraph, mutably.
Sourcepub fn insert(&mut self, name: &str, value: &str)
pub fn insert(&mut self, name: &str, value: &str)
Insert a field into the paragraph.
If a field with the same name already exists, a new field will be added.
Sourcepub fn set(&mut self, name: &str, value: &str)
pub fn set(&mut self, name: &str, value: &str)
Set the value of a field, inserting at the appropriate location if new.
Field names are compared case-insensitively. If a field with the same name already exists, its value will be updated. If the field doesn’t exist, it will be inserted at the appropriate position based on canonical field ordering.
Sourcepub fn set_with_field_order(
&mut self,
name: &str,
value: &str,
field_order: &[&str],
)
pub fn set_with_field_order( &mut self, name: &str, value: &str, field_order: &[&str], )
Set a field using a specific field ordering.
Field names are compared case-insensitively.
Trait Implementations§
Source§impl Deb822LikeParagraph for Paragraph
impl Deb822LikeParagraph for Paragraph
Source§impl IntoIterator for Paragraph
impl IntoIterator for Paragraph
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