[−][src]Struct spdx::expression::Expression
An SPDX license expression that is both syntactically and semantically valid, and can be evaluated
Methods
impl Expression
[src]
pub fn requirements(&self) -> impl Iterator<Item = &ExpressionReq>
[src]
Returns each of the license requirements in the license expression, but not the operators that join them together
pub fn evaluate<AF: FnMut(&LicenseReq) -> bool>(&self, allow_func: AF) -> bool
[src]
Evaluates the expression, using the provided function to determine if the licensee meets the requirements for each license term. If enough requirements are satisfied the evaluation will return true.
pub fn evaluate_with_failures<AF: FnMut(&LicenseReq) -> bool>(
&self,
allow_func: AF
) -> Result<(), Vec<&ExpressionReq>>
[src]
&self,
allow_func: AF
) -> Result<(), Vec<&ExpressionReq>>
Just as with evaluate, the license expression is evaluated to see if enough license requirements in the expresssion are met for the evaluation to succeed, except this method also keeps track of each failed requirement and returns them, allowing for more detailed error reporting about precisely what terms in the expression caused the overall failure
impl Expression
[src]
pub fn parse(original: &str) -> Result<Self, ParseError>
[src]
Given a license expression, attempts to parse and validate it as a valid SPDX expression
The validation can fail for many reasons:
- The expression contains invalid characters
- An unknown/invalid license or exception identifier was found. Only SPDX short identifiers are allowed
- The expression contained unbalanced parentheses
- A license or exception immediately follows another license or exception, without a valid AND, OR, or WITH operator separating them
- An AND, OR, or WITH doesn't have a license or
)
preceding it
Trait Implementations
impl AsRef<str> for Expression
[src]
impl Clone for Expression
[src]
fn clone(&self) -> Expression
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<Expression> for Expression
[src]
impl Display for Expression
[src]
impl Debug for Expression
[src]
Auto Trait Implementations
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
impl RefUnwindSafe for Expression
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,