pub struct DebianSourceControlFile<'a> { /* private fields */ }
Expand description
A Debian source control file/paragraph.
This control file consists of a single paragraph and defines a source package.
This paragraph is typically found in .dsc
files and in Sources
files in repositories.
The fields are defined at https://www.debian.org/doc/debian-policy/ch-controlfields.html#debian-source-control-files-dsc.
Implementations
sourceimpl<'a> DebianSourceControlFile<'a>
impl<'a> DebianSourceControlFile<'a>
sourcepub fn from_reader<R: BufRead>(reader: R) -> Result<Self>
pub fn from_reader<R: BufRead>(reader: R) -> Result<Self>
Construct an instance by reading data from a reader.
The source must be a Debian source control file with exactly 1 paragraph.
The source must not be PGP armored (e.g. beginning with
-----BEGIN PGP SIGNED MESSAGE-----
). For PGP armored data, use
Self::from_armored_reader().
sourcepub fn from_armored_reader<R: BufRead>(reader: R) -> Result<Self>
pub fn from_armored_reader<R: BufRead>(reader: R) -> Result<Self>
Construct an instance by reading data from a reader containing a PGP cleartext signature.
This can be used to parse content from a .dsc
file which begins
with -----BEGIN PGP SIGNED MESSAGE-----
.
An error occurs if the PGP cleartext file is not well-formed or if a PGP parsing error occurs.
The PGP signature is NOT validated. The file will be parsed despite lack of signature verification. This is conceptually insecure. But since Rust has memory safety, some risk is prevented.
sourcepub fn clone_no_signatures(&self) -> Self
pub fn clone_no_signatures(&self) -> Self
Clone without preserving signatures data.
sourcepub fn signatures(&self) -> Option<&CleartextSignatures>
pub fn signatures(&self) -> Option<&CleartextSignatures>
Obtain PGP signatures from this possibly signed file.
sourcepub fn format(&self) -> Result<&str>
pub fn format(&self) -> Result<&str>
The format of the source package.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-format.
sourcepub fn source(&self) -> Result<&str>
pub fn source(&self) -> Result<&str>
The name of the source package.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-source.
sourcepub fn binary(&self) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn binary(&self) -> Option<Box<dyn Iterator<Item = &str>>>
The binary packages this source package produces.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-binary.
sourcepub fn architecture(&self) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn architecture(&self) -> Option<Box<dyn Iterator<Item = &str>>>
The architectures this source package will build for.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-architecture.
sourcepub fn version_str(&self) -> Result<&str>
pub fn version_str(&self) -> Result<&str>
The version number of the package as a string.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-version.
sourcepub fn version(&self) -> Result<PackageVersion>
pub fn version(&self) -> Result<PackageVersion>
The parsed version of the source package.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-version.
sourcepub fn maintainer(&self) -> Result<&str>
pub fn maintainer(&self) -> Result<&str>
The package maintainer.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-maintainer.
sourcepub fn uploaders(&self) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn uploaders(&self) -> Option<Box<dyn Iterator<Item = &str>>>
The list of uploaders and co-maintainers.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-uploaders.
sourcepub fn homepage(&self) -> Option<&str>
pub fn homepage(&self) -> Option<&str>
The URL from which the source of this package can be obtained.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-homepage.
sourcepub fn dgit(&self) -> Option<&str>
pub fn dgit(&self) -> Option<&str>
Describes the Git source from which this package came.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-dgit.
sourcepub fn standards_version(&self) -> Result<&str>
pub fn standards_version(&self) -> Result<&str>
The most recent version of the standards this package conforms to.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-standards-version.
sourcepub fn depends(&self) -> Option<Result<DependencyList>>
pub fn depends(&self) -> Option<Result<DependencyList>>
The Depends
field, parsed to a DependencyList.
sourcepub fn recommends(&self) -> Option<Result<DependencyList>>
pub fn recommends(&self) -> Option<Result<DependencyList>>
The Recommends
field, parsed to a DependencyList.
sourcepub fn suggests(&self) -> Option<Result<DependencyList>>
pub fn suggests(&self) -> Option<Result<DependencyList>>
The Suggests
field, parsed to a DependencyList.
sourcepub fn enhances(&self) -> Option<Result<DependencyList>>
pub fn enhances(&self) -> Option<Result<DependencyList>>
The Enhances
field, parsed to a DependencyList.
sourcepub fn pre_depends(&self) -> Option<Result<DependencyList>>
pub fn pre_depends(&self) -> Option<Result<DependencyList>>
The Pre-Depends
field, parsed to a DependencyList.
sourcepub fn package_dependency_fields(&self) -> Result<PackageDependencyFields>
pub fn package_dependency_fields(&self) -> Result<PackageDependencyFields>
Obtain parsed values of all fields defining dependencies.
sourcepub fn package_list(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFilePackage<'_>>>>>
pub fn package_list(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFilePackage<'_>>>>>
Packages that can be built from this source package.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-package-list.
sourcepub fn checksums_sha1(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
pub fn checksums_sha1(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
List of associated files with SHA-1 checksums.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-checksums.
sourcepub fn checksums_sha256(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
pub fn checksums_sha256(
&self
) -> Option<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
List of associated files with SHA-256 checksums.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-checksums.
sourcepub fn files(
&self
) -> Result<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
pub fn files(
&self
) -> Result<Box<dyn Iterator<Item = Result<DebianSourceControlFileEntry<'_>>>>>
List of associated files with MD5 checksums.
See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-files.
sourcepub fn file_fetches(
&self,
checksum: ChecksumType
) -> Result<Box<dyn Iterator<Item = Result<DebianSourceControlFileFetch>>>>
pub fn file_fetches(
&self,
checksum: ChecksumType
) -> Result<Box<dyn Iterator<Item = Result<DebianSourceControlFileFetch>>>>
Obtain DebianSourceControlFileFetch for a given digest variant.
This obtains records that instruct how to fetch the files that compose this source package.
Methods from Deref<Target = ControlParagraph<'a>>
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the paragraph is empty.
Empty is defined by the lack of any fields.
sourcepub fn set_field(&mut self, field: ControlField<'a>)
pub fn set_field(&mut self, field: ControlField<'a>)
Set the value of a field via a ControlField.
If a field with the same name (case insensitive compare) already exists, the old value will be replaced by the incoming value.
sourcepub fn set_field_from_string(&mut self, name: Cow<'a, str>, value: Cow<'a, str>)
pub fn set_field_from_string(&mut self, name: Cow<'a, str>, value: Cow<'a, str>)
Set the value of a field defined via strings.
If a field with the same name (case insensitive compare) already exists, the old value will be replaced by the incoming value.
sourcepub fn has_field(&self, name: &str) -> bool
pub fn has_field(&self, name: &str) -> bool
Whether a named field is present in this paragraph.
sourcepub fn iter_fields(&self) -> impl Iterator<Item = &ControlField<'a>>
pub fn iter_fields(&self) -> impl Iterator<Item = &ControlField<'a>>
Iterate over fields in this paragraph.
Iteration order is insertion order.
sourcepub fn field(&self, name: &str) -> Option<&ControlField<'a>>
pub fn field(&self, name: &str) -> Option<&ControlField<'a>>
Obtain the field with a given name in this paragraph.
sourcepub fn field_mut(&mut self, name: &str) -> Option<&'a mut ControlField<'_>>
pub fn field_mut(&mut self, name: &str) -> Option<&'a mut ControlField<'_>>
Obtain a mutable reference to the field with a given name.
sourcepub fn required_field(&self, name: &str) -> Result<&ControlField<'a>>
pub fn required_field(&self, name: &str) -> Result<&ControlField<'a>>
Obtain the named field and error if it isn’t defined.
sourcepub fn field_str(&self, name: &str) -> Option<&str>
pub fn field_str(&self, name: &str) -> Option<&str>
Obtain the raw string value of the named field.
sourcepub fn required_field_str(&self, name: &str) -> Result<&str>
pub fn required_field_str(&self, name: &str) -> Result<&str>
Obtain the raw string value of the named field, erroring if the field is not present.
sourcepub fn field_bool(&self, name: &str) -> Option<bool>
pub fn field_bool(&self, name: &str) -> Option<bool>
Obtain the value of a field, evaluated as a boolean.
The field is true iff its string value is yes
.
sourcepub fn field_u64(&self, name: &str) -> Option<Result<u64>>
pub fn field_u64(&self, name: &str) -> Option<Result<u64>>
Obtain the value of a field, evaluated as a u64.
sourcepub fn field_dependency_list(
&self,
name: &str
) -> Option<Result<DependencyList>>
pub fn field_dependency_list(
&self,
name: &str
) -> Option<Result<DependencyList>>
Obtain the value of a field, parsed as a DependencyList.
sourcepub fn field_datetime_rfc5322(
&self,
name: &str
) -> Option<Result<DateTime<Utc>>>
pub fn field_datetime_rfc5322(
&self,
name: &str
) -> Option<Result<DateTime<Utc>>>
Obtain the value of a field parsed as an RFC 5322 date string.
This will parse values like Sat, 09 Oct 2021 09:34:56 UTC
.
The timezone is always normalized to UTC even if it is expressed differently in the source string.
sourcepub fn field_simple(&self, name: &str) -> Option<Result<ControlFieldValue<'a>>>
pub fn field_simple(&self, name: &str) -> Option<Result<ControlFieldValue<'a>>>
Obtain the field with the given name as a ControlFieldValue::Simple, if possible.
sourcepub fn field_folded(&self, name: &str) -> Option<ControlFieldValue<'a>>
pub fn field_folded(&self, name: &str) -> Option<ControlFieldValue<'a>>
Obtain the field with the given name as a ControlFieldValue::Folded.
sourcepub fn field_multiline(&self, name: &str) -> Option<ControlFieldValue<'a>>
pub fn field_multiline(&self, name: &str) -> Option<ControlFieldValue<'a>>
Obtain the field with the given name as a ControlFieldValue::Multiline.
sourcepub fn iter_field_words(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn iter_field_words(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
Obtain an iterator of words in the named field.
sourcepub fn iter_field_lines(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn iter_field_lines(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
Obtain an iterator of lines in the named field.
sourcepub fn iter_field_comma_delimited(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
pub fn iter_field_comma_delimited(
&self,
name: &str
) -> Option<Box<dyn Iterator<Item = &str>>>
Obtain an iterator of comma-delimited values in the named field.
sourcepub fn as_str_hash_map(&self) -> HashMap<&str, &str>
pub fn as_str_hash_map(&self) -> HashMap<&str, &str>
Convert this paragraph to a HashMap.
Values will be the string normalization of the field value, including newlines and leading whitespace.
If a field occurs multiple times, its last value will be recorded in the returned map.
sourcepub fn write<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn write<W: Write>(&self, writer: &mut W) -> Result<()>
Serialize the paragraph to a writer.
A trailing newline is written as part of the final field. However, an extra newline is not present. So if serializing multiple paragraphs, an additional line break must be written to effectively terminate this paragraph if the writer is not at EOF.
Trait Implementations
sourceimpl<'a> Default for DebianSourceControlFile<'a>
impl<'a> Default for DebianSourceControlFile<'a>
sourcefn default() -> DebianSourceControlFile<'a>
fn default() -> DebianSourceControlFile<'a>
Returns the “default value” for a type. Read more
sourceimpl<'a> Deref for DebianSourceControlFile<'a>
impl<'a> Deref for DebianSourceControlFile<'a>
type Target = ControlParagraph<'a>
type Target = ControlParagraph<'a>
The resulting type after dereferencing.
sourceimpl<'a> DerefMut for DebianSourceControlFile<'a>
impl<'a> DerefMut for DebianSourceControlFile<'a>
sourceimpl<'a> From<ControlParagraph<'a>> for DebianSourceControlFile<'a>
impl<'a> From<ControlParagraph<'a>> for DebianSourceControlFile<'a>
sourcefn from(paragraph: ControlParagraph<'a>) -> Self
fn from(paragraph: ControlParagraph<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<DebianSourceControlFile<'a>> for ControlParagraph<'a>
impl<'a> From<DebianSourceControlFile<'a>> for ControlParagraph<'a>
sourcefn from(cf: DebianSourceControlFile<'a>) -> Self
fn from(cf: DebianSourceControlFile<'a>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<'a> RefUnwindSafe for DebianSourceControlFile<'a>
impl<'a> Send for DebianSourceControlFile<'a>
impl<'a> Sync for DebianSourceControlFile<'a>
impl<'a> Unpin for DebianSourceControlFile<'a>
impl<'a> UnwindSafe for DebianSourceControlFile<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more