Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 wasm target #331

Merged
merged 1 commit into from
May 16, 2024
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
10 changes: 0 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ jobs:
protoc-version: '3.19.4'
- run: cargo bench

wasm-build:
name: Build for WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
- run: cargo build --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml

kind:
name: Try in kind (Kubernetes in Docker)
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions limitador/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ documentation = "https://docs.rs/limitador"
readme = "README.md"
edition = "2021"

# We make redis optional to be able to compile for wasm32.
[features]
default = ["disk_storage", "redis_storage"]
disk_storage = ["rocksdb"]
Expand Down Expand Up @@ -60,7 +59,7 @@ tokio = { version = "1", features = [
"rt-multi-thread",
"macros",
"time",
] } # wasm_storage tests use tokio::test
] }

[[bench]]
name = "bench"
Expand Down
11 changes: 0 additions & 11 deletions limitador/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![docs.rs](https://docs.rs/limitador/badge.svg)](https://docs.rs/limitador)

An embeddable rate-limiter library supporting in-memory, Redis and disk data stores.
Limitador can also be compiled to WebAssembly.

For the complete documentation of the crate's API, please refer to [docs.rs](https://docs.rs/limitador/latest/limitador/)

Expand All @@ -14,13 +13,3 @@ For the complete documentation of the crate's API, please refer to [docs.rs](htt
* `disk_storage`: support for using RocksDB as a local disk storage backend.
* `lenient_conditions`: support for the deprecated syntax of `Condition`s
* `default`: `redis_storage`.

### WebAssembly support

To use Limitador in a project that compiles to WASM, there are some features
that need to be disabled. Add this to your `Cargo.toml` instead:

```toml
[dependencies]
limitador = { version = "0.3.0", default-features = false }
```
1 change: 0 additions & 1 deletion limitador/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ impl Counter {
}
}

#[cfg(not(target_arch = "wasm32"))]
pub(crate) fn key(&self) -> Self {
Self {
limit: self.limit.clone(),
Expand Down
1 change: 0 additions & 1 deletion limitador/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use thiserror::Error;
#[cfg(feature = "disk_storage")]
pub mod disk;
pub mod in_memory;
pub mod wasm;

#[cfg(feature = "redis_storage")]
pub mod redis;
Expand Down
292 changes: 0 additions & 292 deletions limitador/src/storage/wasm.rs

This file was deleted.

Loading
Loading