Skip to main content

Description

Struct Description 

Source
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

Source

pub fn set_depends<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete Depends collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_imports<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete Imports collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_suggests<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete Suggests collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_enhances<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete Enhances collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_linking_to<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete LinkingTo collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_vignette_builder<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Relation>,

Sets the complete VignetteBuilder collection in iteration order.

§Errors

Returns an error if the collection cannot be serialized or the field cannot be edited.

Source

pub fn set_additional_repositories<I, T>( &self, values: I, ) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Url>,

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.

Source

pub fn set_remotes<I, T>(&self, values: I) -> Result<Self, CollectionEditError>
where I: IntoIterator<Item = T>, T: Borrow<Remote>,

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

Source

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

Source

pub fn version_parsed(&self) -> Option<Result<Version, VersionParseError>>

Parses the last Version declaration.

Source

pub fn depends_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all Depends declarations.

Source

pub fn imports_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all Imports declarations.

Source

pub fn suggests_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all Suggests declarations.

Source

pub fn enhances_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all Enhances declarations.

Source

pub fn linking_to_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all LinkingTo declarations.

Source

pub fn vignette_builder_parsed( &self, ) -> CollectionResult<Relation, PositionedRelationParseError>

Parses and merges all VignetteBuilder declarations.

Source

pub fn urls_parsed(&self) -> CollectionResult<Url, PositionedUrlParseError>

Parses and merges all URL declarations.

Source

pub fn bug_reports_parsed( &self, ) -> CollectionResult<Url, PositionedUrlParseError>

Parses and merges all BugReports declarations.

Source

pub fn additional_repositories_parsed( &self, ) -> CollectionResult<Url, PositionedUrlParseError>

Parses and merges all Additional_repositories declarations.

Source

pub fn remotes_parsed( &self, ) -> CollectionResult<Remote, PositionedRemoteParseError>

Parses and merges all Remotes declarations.

Source

pub fn needs_compilation_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>

Parses the last NeedsCompilation declaration.

Source

pub fn biarch_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last Biarch declaration.

Source

pub fn lazy_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last LazyData declaration.

Source

pub fn lazy_load_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last LazyLoad declaration.

Source

pub fn byte_compile_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last ByteCompile declaration.

Source

pub fn keep_source_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last KeepSource declaration.

Source

pub fn use_lto_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last UseLTO declaration.

Source

pub fn staged_install_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>

Parses the last StagedInstall declaration.

Source

pub fn zip_data_parsed(&self) -> Option<Result<Logical, LogicalParseError>>

Parses the last ZipData declaration.

Source

pub fn build_vignettes_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>

Parses the last BuildVignettes declaration.

Source

pub fn license_is_foss_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>

Parses the last License_is_FOSS declaration.

Source

pub fn license_restricts_use_parsed( &self, ) -> Option<Result<Logical, LogicalParseError>>

Parses the last License_restricts_use declaration.

Source

pub fn os_type_parsed(&self) -> Option<Result<OsType, OsTypeParseError>>

Parses the last OS_type declaration.

Source

pub fn priority_parsed(&self) -> Option<Result<Priority, PriorityParseError>>

Parses the last Priority declaration.

Source§

impl Description

Source

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

Source

pub fn builder() -> DescriptionBuilder

Starts a canonical DESCRIPTION builder.

Source

pub fn parse(source: &str) -> Self

Parses UTF-8 text infallibly, retaining malformed text and diagnostics.

Source

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.

Source

pub fn from_parse(parse: Parse) -> Self

Wraps an existing DCF parse.

Source

pub const fn as_parse(&self) -> &Parse

Returns the owned lower-level parse.

Source

pub fn into_parse(self) -> Parse

Consumes this wrapper and returns the lower-level parse.

Source

pub fn diagnostics(&self) -> &[SyntaxDiagnostic]

Returns syntax diagnostics in source order.

Source

pub fn records(&self) -> impl Iterator<Item = Record>

Iterates over all records in source order.

Source

pub fn primary_record(&self) -> Option<Record>

Returns the first record, conventionally the package record.

Source

pub fn field(&self, name: &str) -> Option<Field>

Returns the last case-sensitive match in the primary record.

Source

pub fn fields<'a>(&'a self, name: &'a str) -> impl Iterator<Item = Field> + 'a

Iterates over case-sensitive matches in the primary record.

Source

pub fn fields_all(&self) -> impl Iterator<Item = Field>

Iterates over every valid field in every record in source order.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

pub fn upsert( &self, name: &FieldName, value: &LogicalValue, ) -> Result<Self, EditError>

Alias for Self::set_field.

§Errors

Returns the same errors as Self::set_field.

Source§

impl Description

Source

pub fn package(&self) -> Option<ValueText>

Returns raw Package from the last declaration.

Source

pub fn type_(&self) -> Option<ValueText>

Returns raw Type from the last declaration.

Source

pub fn package_type(&self) -> Option<ValueText>

Returns raw Type from the last declaration.

Source

pub fn title(&self) -> Option<ValueText>

Returns raw Title from the last declaration.

Source

pub fn version(&self) -> Option<ValueText>

Returns raw Version from the last declaration.

Source

pub fn date(&self) -> Option<ValueText>

Returns raw Date from the last declaration.

Source

pub fn date_publication(&self) -> Option<ValueText>

Returns raw Date/Publication from the last declaration.

Source

pub fn authors_at_r(&self) -> Option<ValueText>

Returns raw Authors@R from the last declaration.

Source

pub fn author(&self) -> Option<ValueText>

Returns raw Author from the last declaration.

Source

pub fn maintainer(&self) -> Option<ValueText>

Returns raw Maintainer from the last declaration.

Source

pub fn copyright(&self) -> Option<ValueText>

Returns raw Copyright from the last declaration.

Source

pub fn description(&self) -> Option<ValueText>

Returns raw Description from the last declaration.

Source

pub fn license(&self) -> Option<ValueText>

Returns raw License from the last declaration.

Source

pub fn depends(&self) -> Option<ValueText>

Returns raw Depends from the last declaration.

Source

pub fn imports(&self) -> Option<ValueText>

Returns raw Imports from the last declaration.

Source

pub fn suggests(&self) -> Option<ValueText>

Returns raw Suggests from the last declaration.

Source

pub fn enhances(&self) -> Option<ValueText>

Returns raw Enhances from the last declaration.

Source

pub fn linking_to(&self) -> Option<ValueText>

Returns raw LinkingTo from the last declaration.

Source

pub fn system_requirements(&self) -> Option<ValueText>

Returns raw SystemRequirements from the last declaration.

Source

pub fn url(&self) -> Option<ValueText>

Returns raw URL from the last declaration.

Source

pub fn bug_reports(&self) -> Option<ValueText>

Returns raw BugReports from the last declaration.

Source

pub fn additional_repositories(&self) -> Option<ValueText>

Returns raw Additional_repositories from the last declaration.

Source

pub fn remotes(&self) -> Option<ValueText>

Returns raw Remotes from the last declaration.

Source

pub fn encoding(&self) -> Option<ValueText>

Returns raw Encoding from the last declaration.

Source

pub fn repository(&self) -> Option<ValueText>

Returns raw Repository from the last declaration.

Source

pub fn contact(&self) -> Option<ValueText>

Returns raw Contact from the last declaration.

Source

pub fn mailing_list(&self) -> Option<ValueText>

Returns raw MailingList from the last declaration.

Source

pub fn note(&self) -> Option<ValueText>

Returns raw Note from the last declaration.

Source

pub fn needs_compilation(&self) -> Option<ValueText>

Returns raw NeedsCompilation from the last declaration.

Source

pub fn os_type(&self) -> Option<ValueText>

Returns raw OS_type from the last declaration.

Source

pub fn priority(&self) -> Option<ValueText>

Returns raw Priority from the last declaration.

Source

pub fn archs(&self) -> Option<ValueText>

Returns raw Archs from the last declaration.

Source

pub fn biarch(&self) -> Option<ValueText>

Returns raw Biarch from the last declaration.

Source

pub fn classification_acm(&self) -> Option<ValueText>

Returns raw Classification/ACM from the last declaration.

Source

pub fn classification_acm_2012(&self) -> Option<ValueText>

Returns raw Classification/ACM-2012 from the last declaration.

Source

pub fn classification_jel(&self) -> Option<ValueText>

Returns raw Classification/JEL from the last declaration.

Source

pub fn classification_msc(&self) -> Option<ValueText>

Returns raw Classification/MSC from the last declaration.

Source

pub fn classification_msc_2010(&self) -> Option<ValueText>

Returns raw Classification/MSC-2010 from the last declaration.

Source

pub fn collate(&self) -> Option<ValueText>

Returns raw Collate from the last declaration.

Source

pub fn lazy_data(&self) -> Option<ValueText>

Returns raw LazyData from the last declaration.

Source

pub fn lazy_load(&self) -> Option<ValueText>

Returns raw LazyLoad from the last declaration.

Source

pub fn byte_compile(&self) -> Option<ValueText>

Returns raw ByteCompile from the last declaration.

Source

pub fn keep_source(&self) -> Option<ValueText>

Returns raw KeepSource from the last declaration.

Source

pub fn use_lto(&self) -> Option<ValueText>

Returns raw UseLTO from the last declaration.

Source

pub fn staged_install(&self) -> Option<ValueText>

Returns raw StagedInstall from the last declaration.

Source

pub fn zip_data(&self) -> Option<ValueText>

Returns raw ZipData from the last declaration.

Source

pub fn build_vignettes(&self) -> Option<ValueText>

Returns raw BuildVignettes from the last declaration.

Source

pub fn license_is_foss(&self) -> Option<ValueText>

Returns raw License_is_FOSS from the last declaration.

Source

pub fn license_restricts_use(&self) -> Option<ValueText>

Returns raw License_restricts_use from the last declaration.

Source

pub fn vignette_builder(&self) -> Option<ValueText>

Returns raw VignetteBuilder from the last declaration.

Source

pub fn roxygen_note(&self) -> Option<ValueText>

Returns raw RoxygenNote from the last declaration.

Source

pub fn rd_macros(&self) -> Option<ValueText>

Returns raw RdMacros from the last declaration.

Source

pub fn packaged(&self) -> Option<ValueText>

Returns raw Packaged from the last declaration.

Source

pub fn built(&self) -> Option<ValueText>

Returns raw Built from the last declaration.

Trait Implementations§

Source§

impl Clone for Description

Source§

fn clone(&self) -> Self

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 Description

Source§

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

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

impl Display for Description

Source§

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

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

impl Eq for Description

Source§

impl PartialEq for Description

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Description

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.