pub enum LicenseExpression {
License(String),
LicenseRef(String),
And {
left: Box<LicenseExpression>,
right: Box<LicenseExpression>,
},
Or {
left: Box<LicenseExpression>,
right: Box<LicenseExpression>,
},
With {
left: Box<LicenseExpression>,
right: Box<LicenseExpression>,
},
}Expand description
A parsed license expression represented as an AST.
Variants§
License(String)
A single license key
LicenseRef(String)
A LicenseRef-scancode-* reference
And
AND operation: left AND right
Or
OR operation: left OR right
With
WITH operation: left WITH right (exception)
Implementations§
Source§impl LicenseExpression
impl LicenseExpression
Sourcepub fn license_keys(&self) -> Vec<String>
pub fn license_keys(&self) -> Vec<String>
Extract all license keys from the expression.
Sourcepub fn and(expressions: Vec<LicenseExpression>) -> Option<LicenseExpression>
pub fn and(expressions: Vec<LicenseExpression>) -> Option<LicenseExpression>
Create an AND expression combining multiple expressions.
Sourcepub fn or(expressions: Vec<LicenseExpression>) -> Option<LicenseExpression>
pub fn or(expressions: Vec<LicenseExpression>) -> Option<LicenseExpression>
Create an OR expression combining multiple expressions.
Trait Implementations§
Source§impl Clone for LicenseExpression
impl Clone for LicenseExpression
Source§fn clone(&self) -> LicenseExpression
fn clone(&self) -> LicenseExpression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LicenseExpression
impl Debug for LicenseExpression
Source§impl PartialEq for LicenseExpression
impl PartialEq for LicenseExpression
impl StructuralPartialEq for LicenseExpression
Auto Trait Implementations§
impl Freeze for LicenseExpression
impl RefUnwindSafe for LicenseExpression
impl Send for LicenseExpression
impl Sync for LicenseExpression
impl Unpin for LicenseExpression
impl UnsafeUnpin for LicenseExpression
impl UnwindSafe for LicenseExpression
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more