pub struct Description { /* private fields */ }Expand description
A lossless parsed R package DESCRIPTION document.
The type owns only the persistent syntax parse. Cloning is inexpensive and the type is safe to move or share between threads.
Implementations§
Source§impl Description
impl Description
Sourcepub fn set_depends<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
pub fn set_depends<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
Sets the complete Depends collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_imports<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
pub fn set_imports<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
Sets the complete Imports collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_suggests<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
pub fn set_suggests<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
Sets the complete Suggests collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_enhances<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
pub fn set_enhances<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
Sets the complete Enhances collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_linking_to<I, T>(
&self,
values: I,
) -> Result<Self, CollectionEditError>
pub fn set_linking_to<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
Sets the complete LinkingTo collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_vignette_builder<I, T>(
&self,
values: I,
) -> Result<Self, CollectionEditError>
pub fn set_vignette_builder<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
Sets the complete VignetteBuilder collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_additional_repositories<I, T>(
&self,
values: I,
) -> Result<Self, CollectionEditError>
pub fn set_additional_repositories<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
Sets the complete Additional_repositories collection in iteration order.
§Errors
Returns an error if the collection cannot be serialized or the field cannot be edited.
Sourcepub fn set_remotes<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
pub fn set_remotes<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
Sets the complete Remotes collection in iteration order.
§Errors
Returns an error if a remote serializes to invalid syntax or the field cannot be edited.
Source§impl Description
impl Description
Sourcepub fn normalize(&self) -> Result<Self, NormalizationError>
pub fn normalize(&self) -> Result<Self, NormalizationError>
Normalizes the complete DESCRIPTION document into one canonical form.
The operation is atomic. It returns diagnostics instead of output when malformed syntax, multiple records, or invalid structured collections make a semantics-preserving transformation unsafe.
§Errors
Returns every normalization blocker found in deterministic order.
Source§impl Description
impl Description
Sourcepub fn version_parsed(&self) -> Option<Result<Version, VersionParseError>>
pub fn version_parsed(&self) -> Option<Result<Version, VersionParseError>>
Parses the last Version declaration.
Sourcepub fn depends_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn depends_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all Depends declarations.
Sourcepub fn imports_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn imports_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all Imports declarations.
Sourcepub fn suggests_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn suggests_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all Suggests declarations.
Sourcepub fn enhances_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn enhances_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all Enhances declarations.
Sourcepub fn linking_to_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn linking_to_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all LinkingTo declarations.
Sourcepub fn vignette_builder_parsed(
&self,
) -> CollectionResult<Relation, PositionedRelationParseError>
pub fn vignette_builder_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>
Parses and merges all VignetteBuilder declarations.
Sourcepub fn urls_parsed(&self) -> CollectionResult<Url, PositionedUrlParseError>
pub fn urls_parsed(&self) -> CollectionResult<Url, PositionedUrlParseError>
Parses and merges all URL declarations.
Sourcepub fn bug_reports_parsed(
&self,
) -> CollectionResult<Url, PositionedUrlParseError>
pub fn bug_reports_parsed( &self, ) -> CollectionResult<Url, PositionedUrlParseError>
Parses and merges all BugReports declarations.
Sourcepub fn additional_repositories_parsed(
&self,
) -> CollectionResult<Url, PositionedUrlParseError>
pub fn additional_repositories_parsed( &self, ) -> CollectionResult<Url, PositionedUrlParseError>
Parses and merges all Additional_repositories declarations.
Sourcepub fn remotes_parsed(
&self,
) -> CollectionResult<Remote, PositionedRemoteParseError>
pub fn remotes_parsed( &self, ) -> CollectionResult<Remote, PositionedRemoteParseError>
Parses and merges all Remotes declarations.
Sourcepub fn needs_compilation_parsed(
&self,
) -> Option<Result<Logical, LogicalParseError>>
pub fn needs_compilation_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>
Parses the last NeedsCompilation declaration.
Sourcepub fn biarch_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn biarch_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last Biarch declaration.
Sourcepub fn lazy_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn lazy_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last LazyData declaration.
Sourcepub fn lazy_load_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn lazy_load_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last LazyLoad declaration.
Sourcepub fn byte_compile_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn byte_compile_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last ByteCompile declaration.
Sourcepub fn keep_source_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn keep_source_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last KeepSource declaration.
Sourcepub fn use_lto_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn use_lto_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last UseLTO declaration.
Sourcepub fn staged_install_parsed(
&self,
) -> Option<Result<Logical, LogicalParseError>>
pub fn staged_install_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>
Parses the last StagedInstall declaration.
Sourcepub fn zip_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
pub fn zip_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>
Parses the last ZipData declaration.
Sourcepub fn build_vignettes_parsed(
&self,
) -> Option<Result<Logical, LogicalParseError>>
pub fn build_vignettes_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>
Parses the last BuildVignettes declaration.
Sourcepub fn license_is_foss_parsed(
&self,
) -> Option<Result<Logical, LogicalParseError>>
pub fn license_is_foss_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>
Parses the last License_is_FOSS declaration.
Sourcepub fn license_restricts_use_parsed(
&self,
) -> Option<Result<Logical, LogicalParseError>>
pub fn license_restricts_use_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>
Parses the last License_restricts_use declaration.
Sourcepub fn os_type_parsed(&self) -> Option<Result<OsType, OsTypeParseError>>
pub fn os_type_parsed(&self) -> Option<Result<OsType, OsTypeParseError>>
Parses the last OS_type declaration.
Sourcepub fn priority_parsed(&self) -> Option<Result<Priority, PriorityParseError>>
pub fn priority_parsed(&self) -> Option<Result<Priority, PriorityParseError>>
Parses the last Priority declaration.
Source§impl Description
impl Description
Sourcepub fn validate(&self) -> Validation
pub fn validate(&self) -> Validation
Validates DESCRIPTION structure and documented metadata value syntax.
This deliberately excludes CRAN policy, style, and package-directory checks.
Source§impl Description
impl Description
Sourcepub fn builder() -> DescriptionBuilder
pub fn builder() -> DescriptionBuilder
Starts a canonical DESCRIPTION builder.
Sourcepub fn parse(source: &str) -> Self
pub fn parse(source: &str) -> Self
Parses UTF-8 text infallibly, retaining malformed text and diagnostics.
Sourcepub fn parse_utf8(source: &[u8]) -> Result<Self, Utf8Error>
pub fn parse_utf8(source: &[u8]) -> Result<Self, Utf8Error>
Parses bytes after validating UTF-8.
§Errors
Returns the standard UTF-8 error if source is not valid UTF-8.
Sourcepub fn from_parse(parse: Parse) -> Self
pub fn from_parse(parse: Parse) -> Self
Wraps an existing DCF parse.
Sourcepub fn into_parse(self) -> Parse
pub fn into_parse(self) -> Parse
Consumes this wrapper and returns the lower-level parse.
Sourcepub fn diagnostics(&self) -> &[SyntaxDiagnostic]
pub fn diagnostics(&self) -> &[SyntaxDiagnostic]
Returns syntax diagnostics in source order.
Sourcepub fn records(&self) -> impl Iterator<Item = Record>
pub fn records(&self) -> impl Iterator<Item = Record>
Iterates over all records in source order.
Sourcepub fn primary_record(&self) -> Option<Record>
pub fn primary_record(&self) -> Option<Record>
Returns the first record, conventionally the package record.
Sourcepub fn field(&self, name: &str) -> Option<Field>
pub fn field(&self, name: &str) -> Option<Field>
Returns the last case-sensitive match in the primary record.
Sourcepub fn fields<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Field> + 'a
pub fn fields<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Field> + 'a
Iterates over case-sensitive matches in the primary record.
Sourcepub fn fields_all(&self) -> impl Iterator<Item = Field>
pub fn fields_all(&self) -> impl Iterator<Item = Field>
Iterates over every valid field in every record in source order.
Sourcepub fn replace_last(
&self,
name: &str,
value: &LogicalValue,
) -> Result<Self, EditError>
pub fn replace_last( &self, name: &str, value: &LogicalValue, ) -> Result<Self, EditError>
Replaces the last matching field in the primary record.
§Errors
Returns an error if the primary record or matching field is absent.
Sourcepub fn replace_all(
&self,
name: &str,
value: &LogicalValue,
) -> Result<Self, EditError>
pub fn replace_all( &self, name: &str, value: &LogicalValue, ) -> Result<Self, EditError>
Replaces all matching fields in the primary record.
§Errors
Returns an error if the primary record or matching field is absent.
Sourcepub fn insert_after(
&self,
after: &str,
name: &FieldName,
value: &LogicalValue,
) -> Result<Self, EditError>
pub fn insert_after( &self, after: &str, name: &FieldName, value: &LogicalValue, ) -> Result<Self, EditError>
Inserts a field after the last case-sensitive anchor in the primary record.
§Errors
Returns an error if the primary record or anchor field is absent.
Sourcepub fn remove_last(&self, name: &str) -> Result<Self, EditError>
pub fn remove_last(&self, name: &str) -> Result<Self, EditError>
Removes the last matching field from the primary record.
§Errors
Returns an error if the primary record or matching field is absent.
Sourcepub fn remove_all(&self, name: &str) -> Result<Self, EditError>
pub fn remove_all(&self, name: &str) -> Result<Self, EditError>
Removes all matching fields from the primary record.
§Errors
Returns an error if the primary record or matching field is absent.
Sourcepub fn set_field(
&self,
name: &FieldName,
value: &LogicalValue,
) -> Result<Self, EditError>
pub fn set_field( &self, name: &FieldName, value: &LogicalValue, ) -> Result<Self, EditError>
Replaces the last matching field, or inserts it after the final field.
§Errors
Returns an error when there is no primary record. Insertion into an existing but fieldless malformed record is intentionally unsupported.
Source§impl Description
impl Description
Sourcepub fn package_type(&self) -> Option<ValueText>
pub fn package_type(&self) -> Option<ValueText>
Returns raw Type from the last declaration.
Sourcepub fn date_publication(&self) -> Option<ValueText>
pub fn date_publication(&self) -> Option<ValueText>
Returns raw Date/Publication from the last declaration.
Returns raw Authors@R from the last declaration.
Returns raw Author from the last declaration.
Sourcepub fn maintainer(&self) -> Option<ValueText>
pub fn maintainer(&self) -> Option<ValueText>
Returns raw Maintainer from the last declaration.
Sourcepub fn description(&self) -> Option<ValueText>
pub fn description(&self) -> Option<ValueText>
Returns raw Description from the last declaration.
Sourcepub fn linking_to(&self) -> Option<ValueText>
pub fn linking_to(&self) -> Option<ValueText>
Returns raw LinkingTo from the last declaration.
Sourcepub fn system_requirements(&self) -> Option<ValueText>
pub fn system_requirements(&self) -> Option<ValueText>
Returns raw SystemRequirements from the last declaration.
Sourcepub fn bug_reports(&self) -> Option<ValueText>
pub fn bug_reports(&self) -> Option<ValueText>
Returns raw BugReports from the last declaration.
Sourcepub fn additional_repositories(&self) -> Option<ValueText>
pub fn additional_repositories(&self) -> Option<ValueText>
Returns raw Additional_repositories from the last declaration.
Sourcepub fn repository(&self) -> Option<ValueText>
pub fn repository(&self) -> Option<ValueText>
Returns raw Repository from the last declaration.
Sourcepub fn mailing_list(&self) -> Option<ValueText>
pub fn mailing_list(&self) -> Option<ValueText>
Returns raw MailingList from the last declaration.
Sourcepub fn needs_compilation(&self) -> Option<ValueText>
pub fn needs_compilation(&self) -> Option<ValueText>
Returns raw NeedsCompilation from the last declaration.
Sourcepub fn classification_acm(&self) -> Option<ValueText>
pub fn classification_acm(&self) -> Option<ValueText>
Returns raw Classification/ACM from the last declaration.
Sourcepub fn classification_acm_2012(&self) -> Option<ValueText>
pub fn classification_acm_2012(&self) -> Option<ValueText>
Returns raw Classification/ACM-2012 from the last declaration.
Sourcepub fn classification_jel(&self) -> Option<ValueText>
pub fn classification_jel(&self) -> Option<ValueText>
Returns raw Classification/JEL from the last declaration.
Sourcepub fn classification_msc(&self) -> Option<ValueText>
pub fn classification_msc(&self) -> Option<ValueText>
Returns raw Classification/MSC from the last declaration.
Sourcepub fn classification_msc_2010(&self) -> Option<ValueText>
pub fn classification_msc_2010(&self) -> Option<ValueText>
Returns raw Classification/MSC-2010 from the last declaration.
Sourcepub fn byte_compile(&self) -> Option<ValueText>
pub fn byte_compile(&self) -> Option<ValueText>
Returns raw ByteCompile from the last declaration.
Sourcepub fn keep_source(&self) -> Option<ValueText>
pub fn keep_source(&self) -> Option<ValueText>
Returns raw KeepSource from the last declaration.
Sourcepub fn staged_install(&self) -> Option<ValueText>
pub fn staged_install(&self) -> Option<ValueText>
Returns raw StagedInstall from the last declaration.
Sourcepub fn build_vignettes(&self) -> Option<ValueText>
pub fn build_vignettes(&self) -> Option<ValueText>
Returns raw BuildVignettes from the last declaration.
Sourcepub fn license_is_foss(&self) -> Option<ValueText>
pub fn license_is_foss(&self) -> Option<ValueText>
Returns raw License_is_FOSS from the last declaration.
Sourcepub fn license_restricts_use(&self) -> Option<ValueText>
pub fn license_restricts_use(&self) -> Option<ValueText>
Returns raw License_restricts_use from the last declaration.
Sourcepub fn vignette_builder(&self) -> Option<ValueText>
pub fn vignette_builder(&self) -> Option<ValueText>
Returns raw VignetteBuilder from the last declaration.
Sourcepub fn roxygen_note(&self) -> Option<ValueText>
pub fn roxygen_note(&self) -> Option<ValueText>
Returns raw RoxygenNote from the last declaration.