refactor: give some better examples for package ID spec

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
hi-rustin 2023-12-25 10:08:27 +08:00
parent d45969a781
commit ad18dd017b

View file

@ -64,13 +64,15 @@ impl PackageIdSpec {
/// use cargo_util_schemas::core::PackageIdSpec;
///
/// let specs = vec![
/// "https://crates.io/foo",
/// "https://crates.io/foo#1.2.3",
/// "https://crates.io/foo#bar:1.2.3",
/// "https://crates.io/foo#bar@1.2.3",
/// "foo",
/// "foo@1.4",
/// "foo@1.4.3",
/// "foo:1.2.3",
/// "foo@1.2.3",
/// "https://github.com/rust-lang/crates.io-index#foo",
/// "https://github.com/rust-lang/crates.io-index#foo@1.4.3",
/// "ssh://git@github.com/rust-lang/foo.git#foo@1.4.3",
/// "file:///path/to/my/project/foo",
/// "file:///path/to/my/project/foo#1.1.8"
/// ];
/// for spec in specs {
/// assert!(PackageIdSpec::parse(spec).is_ok());