Skip to content

Commit

Permalink
Merge pull request #726 from uuid-rs/chore/pkg-size
Browse files Browse the repository at this point in the history
Reduce the package size of uuid
  • Loading branch information
KodrAus authored Jan 18, 2024
2 parents 2e92a3d + 38f01ff commit ed13c73
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ jobs:
- name: Version features
run: cargo +1.60.0 build --manifest-path tests/smoke-test/Cargo.toml

examples:
name: Tests / Examples
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

- name: Examples
run: cargo test --manifest-path examples/Cargo.toml

wasm_bindgen:
name: Tests / WebAssembly (wasm-bindgen)
runs-on: ubuntu-latest
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ categories = [
description = "A library to generate and parse UUIDs."
documentation = "https://docs.rs/uuid"
edition = "2018"
exclude = [
".github/**"
include = [
"src",
"README.md",
"LICENSE-APACHE",
"LICENSE-MIT",
]
keywords = [
"guid",
Expand Down Expand Up @@ -199,12 +202,9 @@ version = "1.0.52"
[dev-dependencies.rustversion]
version = "1"

[target.'cfg(windows)'.dev-dependencies.windows-sys]
version = "0.48.0"
features = ["Win32_System_Com"]

[workspace]
members = [
"macros",
"examples",
"tests/smoke-test",
]
29 changes: 29 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "uuid-examples"
version = "0.0.0"
publish = false
edition = "2018"

[[example]]
name = "random_uuid"
path = "src/random_uuid.rs"

[[example]]
name = "sortable_uuid"
path = "src/sortable_uuid.rs"

[[example]]
name = "uuid_macro"
path = "src/uuid_macro.rs"

[[example]]
name = "windows_guid"
path = "src/windows_guid.rs"

[dependencies.uuid]
path = "../"
features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8"]

[target.'cfg(windows)'.dev-dependencies.windows-sys]
version = "0.48.0"
features = ["Win32_System_Com"]
4 changes: 0 additions & 4 deletions examples/random_uuid.rs → examples/src/random_uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//!
//! If you enable the `v4` feature you can generate random UUIDs.

#[cfg(feature = "v4")]
fn main() {
use uuid::Uuid;

Expand All @@ -12,6 +11,3 @@ fn main() {

println!("{}", uuid);
}

#[cfg(not(feature = "v4"))]
fn main() {}
4 changes: 0 additions & 4 deletions examples/sortable_uuid.rs → examples/src/sortable_uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//!
//! If you enable the `v7` feature you can generate sortable UUIDs.

#[cfg(feature = "v7")]
fn main() {
use uuid::Uuid;

Expand All @@ -12,6 +11,3 @@ fn main() {

println!("{}", uuid);
}

#[cfg(not(feature = "v7"))]
fn main() {}
5 changes: 1 addition & 4 deletions examples/uuid_macro.rs → examples/src/uuid_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
//! If you enable the `macro-diagnostics` feature, you can see much better
//! error messages.

#[test]
fn parse_uuid_at_compile_time() {
fn main() {
use uuid::uuid;

let uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");

assert_eq!(Some(uuid::Version::Random), uuid.get_version());
}

fn main() {}
File renamed without changes.

0 comments on commit ed13c73

Please sign in to comment.