pub struct ParseMode {
pub allow_lower_case_operators: bool,
pub allow_slash_as_or_operator: bool,
pub allow_imprecise_license_names: bool,
pub allow_postfix_plus_on_gpl: bool,
}
Expand description
Parsing configuration for SPDX expression
Fields§
§allow_lower_case_operators: bool
The AND
, OR
, and WITH
operators are required to be uppercase in
the SPDX spec, but enabling this option allows them to be lowercased
allow_slash_as_or_operator: bool
Allows the use of /
as a synonym for the OR
operator.
This also allows for not having whitespace between the /
and the terms
on either side
allow_imprecise_license_names: bool
Allows some invalid/imprecise identifiers as synonyms for an actual license identifier.
See IMPRECISE_NAMES
for a list
of the current synonyms. Note that this list is not comprehensive but
can be expanded upon when invalid identifiers are found in the wild.
allow_postfix_plus_on_gpl: bool
The various GPL licenses diverge from every other license in the SPDX
license list by having an -or-later
variant that is used as a suffix
on a base license (eg. GPL-3.0-or-later
) rather than the canonical
GPL-3.0+
.
This option just allows GPL licenses to be treated similarly to all of the other SPDX licenses.
Implementations§
source§impl ParseMode
impl ParseMode
sourcepub const STRICT: Self = _
pub const STRICT: Self = _
Strict, specification compliant SPDX parsing.
- Only license identifiers in the SPDX license list, or Document/LicenseRef, are allowed. The license identifiers are also case-sensitive.
WITH
,AND
, andOR
are the only valid operators
sourcepub const LAX: Self = _
pub const LAX: Self = _
Allow non-conforming syntax for crates-io compatibility
- Additional, invalid, identifiers are accepted and mapped to a correct
SPDX license identifier.
See
IMPRECISE_NAMES
for the list of additionally accepted identifiers and the license they correspond to. /
can by used as a synonym forOR
, and doesn’t need to be separated by whitespace from the terms it combines
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParseMode
impl RefUnwindSafe for ParseMode
impl Send for ParseMode
impl Sync for ParseMode
impl Unpin for ParseMode
impl UnwindSafe for ParseMode
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)