Skip to main content

Deb822Action

Enum Deb822Action 

Source
pub enum Deb822Action {
Show 15 variants SetField { file: PathBuf, paragraph: ParagraphSelector, field: String, value: String, }, SetFieldWithIndent { file: PathBuf, paragraph: ParagraphSelector, field: String, value: String, indent: IndentPattern, }, RemoveField { file: PathBuf, paragraph: ParagraphSelector, field: String, }, RenameField { file: PathBuf, paragraph: ParagraphSelector, from: String, to: String, }, RemoveParagraph { file: PathBuf, paragraph: ParagraphSelector, }, AppendParagraph { file: PathBuf, fields: Vec<(String, String)>, indent: Option<usize>, }, NormalizeFieldSpacing { file: PathBuf, paragraph: ParagraphSelector, field: String, }, DropRelation { file: PathBuf, paragraph: ParagraphSelector, field: String, package: String, }, ReplaceRelation { file: PathBuf, paragraph: ParagraphSelector, field: String, from_package: String, to_entry: String, }, EnsureSubstvar { file: PathBuf, paragraph: ParagraphSelector, field: String, substvar: String, }, DropSubstvar { file: PathBuf, paragraph: ParagraphSelector, field: String, substvar: String, }, EnsureRelation { file: PathBuf, paragraph: ParagraphSelector, field: String, entry: String, }, SetRelationVersionConstraint { file: PathBuf, paragraph: ParagraphSelector, field: String, package: String, constraint: Option<(VersionConstraint, Version)>, }, MoveRelation { file: PathBuf, paragraph: ParagraphSelector, from_field: String, to_field: String, package: String, }, ReorderParagraphs { file: PathBuf, key_field: String, order: Vec<String>, },
}
Expand description

Edits to a deb822 file.

Variants§

§

SetField

Set a field value, inserting it if missing.

Continuation-line indentation for multi-line values follows the deb822 default: align continuations to the field-name column. Use SetFieldWithIndent when a field needs a specific indent (e.g. Description / DEP-5 mandate a single-space indent).

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Field name.

§value: String

New value.

§

SetFieldWithIndent

Like SetField, but with an explicit continuation-line indent pattern. Used for fields whose formatting convention diverges from the deb822 default — most notably binary-package Description: (single-space indent per DEP-5) and debian/copyright bodies.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Field name.

§value: String

New value.

§indent: IndentPattern

Continuation-line indent pattern.

§

RemoveField

Remove a field if present.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Field name.

§

RenameField

Rename a field, preserving its value.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§from: String

Current field name.

§to: String

New field name.

§

RemoveParagraph

Remove the paragraph identified by paragraph.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to drop.

§

AppendParagraph

Append a new paragraph at the end of the file with the given (field, value) pairs in order.

Fields

§file: PathBuf

File to edit, relative to the package root.

§fields: Vec<(String, String)>

Fields to populate the new paragraph with.

§indent: Option<usize>

Continuation-line indent for multi-line values, in spaces. None lets the deb822 renderer auto-align to the field-name column (the default for debian/control). Use Some(1) for debian/copyright, where DEP-5 mandates a single-space indent.

§

NormalizeFieldSpacing

Normalize the whitespace around a field’s separator (: and the continuation indent). The deb822 spec allows arbitrary spacing after the colon, but the convention is exactly one space; this action collapses unusual spacing without otherwise touching the value. A no-op if the field already has canonical spacing.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Field name.

§

DropRelation

Drop every relation matching package from a relations field (Depends, Build-Depends, etc.). Empty alternative groups are removed; if the field becomes empty it is removed entirely. A no-op if the package isn’t named in the field.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name (e.g. Build-Depends).

§package: String

Package name to drop.

§

ReplaceRelation

Replace the first relation that names from_package with the to_entry text, keeping the entry’s position in the field. A no-op if from_package isn’t named. If to_entry parses as a relation whose package is already named elsewhere in the field, the original from_package entry is dropped without inserting a duplicate.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name (e.g. Build-Depends).

§from_package: String

Package name (matched exactly) of the relation to replace.

§to_entry: String

New entry text (e.g. perl, debhelper (>= 12)).

§

EnsureSubstvar

Ensure a substvar (${...}) is present in a relations field. If the field doesn’t exist it’s created with just the substvar; if it exists and already mentions the substvar it’s a no-op.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name (e.g. Depends).

§substvar: String

Substvar to ensure, including the surrounding ${...}.

§

DropSubstvar

Drop a substvar (${...}) from a relations field. If the field becomes empty it’s removed entirely. A no-op if the substvar is already absent.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name.

§substvar: String

Substvar to drop, including the surrounding ${...}.

§

EnsureRelation

Ensure a relation entry is present in a relations field, creating the field if necessary. entry is a literal relation entry string (e.g. python3-poetry-core or debhelper-compat (= 13)).

If entry carries no version constraint the action is a no-op when any relation with the same package name is already present. If entry has an exact version, the action upgrades any existing relation to that exact version.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name (e.g. Build-Depends).

§entry: String

Literal relation entry to ensure.

§

SetRelationVersionConstraint

Set the version constraint on every relation in field that names package. Acts per-relation, so the constraint is replaced without removing the package from the field or affecting any alternatives in the same entry. Passing None drops the constraint entirely. A no-op if the package isn’t named in field or every matching relation already has the requested constraint.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§field: String

Relations field name (e.g. Depends).

§package: String

Package name to set the version constraint on.

§constraint: Option<(VersionConstraint, Version)>

New constraint, or None to strip the constraint entirely.

§

MoveRelation

Move a relation entry between two fields of the same paragraph, preserving its version constraint and any alternatives. The entry is identified by package. If from_field becomes empty after the move it is removed entirely. A no-op if the package isn’t present in from_field.

Fields

§file: PathBuf

File to edit, relative to the package root.

§paragraph: ParagraphSelector

Which paragraph to edit.

§from_field: String

Source relations field name.

§to_field: String

Destination relations field name.

§package: String

Package name identifying the entry to move.

§

ReorderParagraphs

Reorder a subset of paragraphs in a deb822 file. Paragraphs that have key_field are pulled out and re-inserted in the order given by order (which lists their key_field values). Other paragraphs stay in place: the i-th slot occupied by a participating paragraph in the original document is filled by the i-th key from order. Keys in order that aren’t present in the document are skipped.

Fields

§file: PathBuf

File to edit, relative to the package root.

§key_field: String

Field whose presence marks a paragraph as participating in the reorder, and whose value identifies it.

§order: Vec<String>

Desired order of key_field values among the participating paragraphs.

Trait Implementations§

Source§

impl Clone for Deb822Action

Source§

fn clone(&self) -> Deb822Action

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Deb822Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Deb822Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Deb822Action

Source§

fn eq(&self, other: &Deb822Action) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Deb822Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Deb822Action

Source§

impl StructuralPartialEq for Deb822Action

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Ungil for T
where T: Send,