diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e81e961..83547b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,13 +50,13 @@ jobs: include: - name: Minimal runner: test - features: --no-default-features + args: -p purl --no-default-features - name: Default runner: test - features: "" + args: -p purl - name: Full runner: tarpaulin - features: --all-features + args: --all-features runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -73,4 +73,4 @@ jobs: rm tarpaulin.tar.gz - name: Run tests - run: cargo ${{ matrix.runner }} ${{ matrix.features }} + run: cargo ${{ matrix.runner }} ${{ matrix.args }} diff --git a/purl/src/builder.rs b/purl/src/builder.rs index 66dfb89..ff24166 100644 --- a/purl/src/builder.rs +++ b/purl/src/builder.rs @@ -10,11 +10,10 @@ use crate::{GenericPurl, ParseError, PurlParts, PurlShape, SmallString}; /// # Example /// /// ``` -/// // `PurlBuilder` is an alias for `GenericPurlBuilder`. -/// use purl::{PackageType, PurlBuilder}; +/// use purl::GenericPurlBuilder; /// /// // Use the builder if you want to set fields besides the type and name. -/// let purl = PurlBuilder::new(PackageType::Maven, "my-package") +/// let purl = GenericPurlBuilder::new(String::from("maven"), "my-package") /// .with_namespace("my.company") /// .build() /// .unwrap(); diff --git a/purl/src/lib.rs b/purl/src/lib.rs index 5ec66fa..806c777 100644 --- a/purl/src/lib.rs +++ b/purl/src/lib.rs @@ -9,6 +9,7 @@ pub use format::*; pub use package_type::*; pub use parse::*; pub use qualifiers::Qualifiers; +#[cfg(feature = "smartstring")] use smartstring::{LazyCompact, SmartString, SmartStringMode}; mod builder; @@ -181,6 +182,7 @@ impl<'a> PurlShape for Cow<'a, str> { /// Without type-specific functionality, it's possible to create PURLs that have /// incorrect capitalization or are missing a required namespace or required /// qualifiers. +#[cfg(feature = "smartstring")] impl PurlShape for SmartString where M: SmartStringMode, @@ -229,11 +231,13 @@ pub struct PurlParts { /// # Example /// /// ``` -/// // `Purl` is an alias for `GenericPurl`. -/// use purl::{PackageType, Purl}; +/// use purl::GenericPurl; /// /// // Use the builder if you want to set fields besides the type and name. -/// let purl = Purl::builder(PackageType::Npm, "my-package").with_version("1.2.3").build().unwrap(); +/// let purl = GenericPurl::builder(String::from("npm"), "my-package") +/// .with_version("1.2.3") +/// .build() +/// .unwrap(); /// /// assert_eq!("pkg:npm/my-package@1.2.3", &purl.to_string()); /// ```