Skip to main content

is_existence_wildcard

Function is_existence_wildcard 

Source
pub fn is_existence_wildcard(req: &VersionReq) -> bool
Expand description

Whether req is a wildcard/empty requirement ("" or "*", ignoring surrounding whitespace) rather than a concrete version constraint.

A wildcard requirement turns get_latest_matching and select_latest_matching into an existence check (“does this package exist / what is its newest version for display purposes”) instead of an upgrade recommendation — see select_latest_for_existence, which callers must gate on this function before use.

§Examples

use deps_core::{VersionReq, is_existence_wildcard};

assert!(is_existence_wildcard(&VersionReq::new("*")));
assert!(is_existence_wildcard(&VersionReq::new("")));
assert!(!is_existence_wildcard(&VersionReq::new("^1.2")));