pub struct Query { /* private fields */ }
Expand description
Queries against the RustSec database
Implementations§
source§impl Query
impl Query
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new query.
This creates a “wildcard” query with no constraints. Use the various builder methods of this type to restrict which advisories match.
Note that this differs from Query::default()
, which scopes the
query to crates (i.e. Query::crate_scope
).
When in doubt, use Query::default()
.
sourcepub fn crate_scope() -> Self
pub fn crate_scope() -> Self
Create a new query which uses the default scope rules for crates:
- Only
Collection::Crates
- Ignore withdrawn advisories
- Ignore informational advisories
sourcepub fn collection(self, collection: Collection) -> Self
pub fn collection(self, collection: Collection) -> Self
Set collection to query against
sourcepub fn package(self, package: &Package) -> Self
pub fn package(self, package: &Package) -> Self
Provide a package and use all of its attributes as part of the query
sourcepub fn package_name(self, name: Name) -> Self
pub fn package_name(self, name: Name) -> Self
Set package name to search for.
sourcepub fn package_version(self, version: Version) -> Self
pub fn package_version(self, version: Version) -> Self
Set package version to search for
sourcepub fn package_source(self, source: SourceId) -> Self
pub fn package_source(self, source: SourceId) -> Self
Set package source (e.g. registry) where this package is located
sourcepub fn severity(self, severity: Severity) -> Self
pub fn severity(self, severity: Severity) -> Self
Set minimum severity threshold according to the CVSS Qualitative Severity Rating Scale.
Vulnerabilities without associated CVSS information will always match regardless of what this is set to.
sourcepub fn target_arch(self, arch: Arch) -> Self
pub fn target_arch(self, arch: Arch) -> Self
Set target architecture
sourcepub fn withdrawn(self, setting: bool) -> Self
pub fn withdrawn(self, setting: bool) -> Self
Query for withdrawn advisories.
By default they will be omitted from query results.
sourcepub fn informational(self, setting: bool) -> Self
pub fn informational(self, setting: bool) -> Self
Query for informational advisories. By default they will be omitted from query results.