Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run no default
run: cargo test --verbose --no-default-features
- name: Build no default
run: cargo build --verbose --no-default-features
13 changes: 9 additions & 4 deletions ndc_stdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ ndc_lib = { workspace = true }
ndc_macros.workspace = true
num.workspace = true
once_cell.workspace = true
rand.workspace = true
regex.workspace = true
serde_json = { workspace = true }
tap.workspace = true

# Optional
rand = { workspace = true, optional = true }
regex = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }

# Crypto
md5 = { version = "0.8.0", optional = true }
sha1 = { version = "0.10.6", optional = true }

[features]
default = ["crypto"]
default = ["crypto", "rand", "regex", "serde"]
crypto = ["dep:md5", "dep:sha1"]
rand = ["dep:rand"]
regex = ["dep:regex"]
serde = ["dep:serde_json"]
12 changes: 9 additions & 3 deletions ndc_stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ pub mod hash_map;
pub mod heap;
pub mod list;
pub mod math;
pub mod rand;
pub mod regex;
pub mod sequence;
pub mod serde;
pub mod string;
pub mod value;

#[cfg(feature = "crypto")]
pub mod crypto;
#[cfg(feature = "rand")]
pub mod rand;
#[cfg(feature = "regex")]
pub mod regex;
#[cfg(feature = "serde")]
pub mod serde;

pub fn register(env: &mut Environment) {
aoc::register(env);
Expand All @@ -32,10 +35,13 @@ pub fn register(env: &mut Environment) {
list::register(env);
math::f64::register(env);
math::register(env);
#[cfg(feature = "rand")]
rand::register(env);
#[cfg(feature = "regex")]
regex::register(env);
sequence::extra::register(env);
sequence::register(env);
#[cfg(feature = "serde")]
serde::register(env);
string::register(env);
value::register(env);
Expand Down