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

Introduce ByteUnit #147

Merged
merged 2 commits into from
Jan 4, 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
use pavex::blueprint::{constructor::Lifecycle, Blueprint};
use pavex::f;
use pavex::request::body::BodySizeLimit;
use pavex::unit::ToByteUnit;

pub fn body_size_limit() -> BodySizeLimit {
BodySizeLimit::Enabled {
max_n_bytes: 10_485_760, // 10 MBs
max_size: 2.megabytes(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use pavex::blueprint::{constructor::Lifecycle, router::POST, Blueprint};
use pavex::f;
use pavex::request::body::BodySizeLimit;
use pavex::unit::ToByteUnit;

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
Expand All @@ -21,7 +22,7 @@ fn upload_bp() -> Blueprint {

pub fn upload_size_limit() -> BodySizeLimit {
BodySizeLimit::Enabled {
max_n_bytes: 1_073_741_824, // 1GB
max_size: 1.gigabytes(),
}
}
```
10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/buffered_body/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use pavex::blueprint::{constructor::Lifecycle, Blueprint};
use pavex::f;
use pavex::request::body::BodySizeLimit;
use pavex::unit::ToByteUnit;

pub fn body_size_limit() -> BodySizeLimit {
BodySizeLimit::Enabled {
max_n_bytes: 10_485_760, // 10 MBs
max_size: 2.megabytes(),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use pavex::blueprint::{constructor::Lifecycle, router::POST, Blueprint};
use pavex::f;
use pavex::request::body::BodySizeLimit;
use pavex::unit::ToByteUnit;

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
Expand All @@ -20,6 +21,6 @@ fn upload_bp() -> Blueprint {

pub fn upload_size_limit() -> BodySizeLimit {
BodySizeLimit::Enabled {
max_n_bytes: 1_073_741_824, // 1GB
max_size: 1.gigabytes(),
}
}
2 changes: 1 addition & 1 deletion doc_examples/guide/request_data/buffered_body/tutorial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ snippets:
hl_lines: [ 4 ]
- name: "custom_limit"
source_path: "src/custom_limit/blueprint.rs"
ranges: [ "0..13", "19..20" ]
ranges: [ "0..14", "20..21" ]
- name: "no_limit"
source_path: "src/no_limit/blueprint.rs"
ranges: [ "0..11", "17..18" ]
Expand Down
10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/json/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/path/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/query/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/query_params/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/request_target/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc_examples/guide/request_data/route_params/project/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions libs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/pavex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ paste = "1"
tracing = "0.1"
http-body-util = "0.1"
pin-project-lite = "0.2"
ubyte = { version = "0.10.4", features = ["serde"] }

# Route parameters
matchit = { git = "https://github.com/ibraheemdev/matchit", branch = "master" }
Expand Down
1 change: 1 addition & 0 deletions libs/pavex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ pub mod router;
pub mod serialization;
#[cfg(feature = "server")]
pub mod server;
pub mod unit;
Loading
Loading