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

rust: bump ohkami to v0.21 #8180

Merged
merged 4 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 8 deletions rust/ohkami/Cargo.toml → rust/ohkami-nio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ edition = "2021"
publish = false

[profile.release]
opt-level = 3
debug = false
debug-assertions = false
lto = true
panic = "abort"
incremental = false
lto = true
panic = "abort"
codegen-units = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed 😛

compilation options are in rust/Dockerfile

what is codegen-units for ?

rpath = false
strip = false

[dependencies]
ohkami = { version = "0.21", features = ["rt_nio"] }
Expand Down
2 changes: 2 additions & 0 deletions rust/ohkami/config.yaml → rust/ohkami-nio/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
framework:
github: ohkami-rs/ohkami
version: 0.21
engines:
- nio
File renamed without changes.
14 changes: 14 additions & 0 deletions rust/ohkami-tokio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "server"
version = "0.0.0"
edition = "2021"
publish = false

[profile.release]
lto = true
panic = "abort"
codegen-units = 1
Comment on lines +7 to +10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[profile.release]
lto = true
panic = "abort"
codegen-units = 1

Copy link
Contributor Author

@kanarus kanarus Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're quite standard optimizations for release profile ( other rust frameworks do the same in their Cargo.tomls, too )

Copy link
Contributor Author

@kanarus kanarus Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now almost all rust/* are using

[profile.release]
opt-level = 3
debug = false
debug-assertions = false
lto = true
panic = "abort"
incremental = false
codegen-units = 1
rpath = false
strip = false

( see their Cargo.tomls )

but actually other than lto = true, panic = "abort" and codegen-units = 1 are default configuration of release profile, so I just set them

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed them in current branch, from advice of @msrd0. The compilation step is

cargo build --release  \
  --config  'profile.release.lto=true' \
  --config  'profile.release.panic="abort"' \
  --config  'profile.release.codegen-units=1'


[dependencies]
ohkami = { version = "0.21", features = ["rt_tokio"] }
tokio = { version = "1.43", features = ["full"] }
5 changes: 5 additions & 0 deletions rust/ohkami-tokio/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework:
github: ohkami-rs/ohkami
version: 0.21
engines:
- tokio
13 changes: 13 additions & 0 deletions rust/ohkami-tokio/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use ohkami::prelude::*;

#[tokio::main]
async fn main() {
Ohkami::new((
"/"
.GET(|| async {Response::OK()}),
"/user"
.POST(|| async {Response::OK()}),
"/user/:id"
.GET(|id: String| async {id}),
)).howl("0.0.0.0:3000").await
}
Loading