mirror of
https://github.com/NexVeridian/ark-invest-api-rust.git
synced 2025-09-02 01:49:11 +00:00
fix: cranelift
This commit is contained in:
parent
531af211bf
commit
300c06d48b
7 changed files with 378 additions and 252 deletions
|
@ -1,9 +1,14 @@
|
||||||
# [target.x86_64-unknown-linux-gnu]
|
|
||||||
# linker = "clang"
|
|
||||||
# rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]
|
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
t = "nextest run"
|
t = "nextest run"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
target-dir = "target/target"
|
target-dir = "target/target"
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
codegen-backend = true
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
codegen-backend = "cranelift"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
codegen-backend = "cranelift"
|
||||||
|
|
511
Cargo.lock
generated
511
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ark-invest-api-rust"
|
name = "ark-invest-api-rust"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
polars = { version = "0.45", features = [
|
polars = { version = "0.45", features = [
|
||||||
|
@ -15,7 +15,7 @@ polars = { version = "0.45", features = [
|
||||||
axum = "0.7"
|
axum = "0.7"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tokio = { version = "1.42", features = ["full"] }
|
tokio = { version = "1.43", features = ["full"] }
|
||||||
aide = { version = "0.13", features = ["redoc", "axum"] }
|
aide = { version = "0.13", features = ["redoc", "axum"] }
|
||||||
schemars = { version = "0.8", features = ["chrono"] }
|
schemars = { version = "0.8", features = ["chrono"] }
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
|
|
43
flake.lock
generated
43
flake.lock
generated
|
@ -3,11 +3,11 @@
|
||||||
"advisory-db": {
|
"advisory-db": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733749954,
|
"lastModified": 1740407442,
|
||||||
"narHash": "sha256-2Ug80Uf/oUujxgh02Iy5vTG0V+Ab9+YUHuRLRY0ayiY=",
|
"narHash": "sha256-EGzWKm5cUDDJbwVzxSB4N/+CIVycwOG60Gh5f1Vp7JM=",
|
||||||
"owner": "rustsec",
|
"owner": "rustsec",
|
||||||
"repo": "advisory-db",
|
"repo": "advisory-db",
|
||||||
"rev": "ec9ce28714bb38d77a2223e7266df705500a7f11",
|
"rev": "2e25d9665f10de885c81a9fb9d51a289f625b05f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -18,11 +18,11 @@
|
||||||
},
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1734324364,
|
"lastModified": 1739936662,
|
||||||
"narHash": "sha256-omYTR59TdH0AumP1cfh49fBnWZ52HjfdNfaLzCMZBx0=",
|
"narHash": "sha256-x4syUjNUuRblR07nDPeLDP7DpphaBVbUaSoeZkFbGSk=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "60d7623f1320470bf2fdb92fd2dca1e9a27b98ce",
|
"rev": "19de14aaeb869287647d9461cbd389187d8ecdb7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -36,14 +36,14 @@
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-analyzer-src": []
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1734417396,
|
"lastModified": 1740897281,
|
||||||
"narHash": "sha256-32x1Z+Pz3Jv0cK9EG56cFTKXy/mZ/c+Ikxw+aVfKHp4=",
|
"narHash": "sha256-lUCeMKV8sUn8Y4R+4OzFMqH0k00KqvbIu0vSIMsWpH0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "a18d41b26e998e95a598858fdb86ba22fb5da47d",
|
"rev": "2a4bbf46e00e06967f55b3a55a685d2039f2b572",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -72,11 +72,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1734126203,
|
"lastModified": 1740791350,
|
||||||
"narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=",
|
"narHash": "sha256-igS2Z4tVw5W/x3lCZeeadt0vcU9fxtetZ/RyrqsCRQ0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "71a6392e367b08525ee710a93af2e80083b5b3e2",
|
"rev": "199169a2135e6b864a888e89a2ace345703c025d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -95,6 +95,23 @@
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1740851167,
|
||||||
|
"narHash": "sha256-sFRsGYrI2Z4X+P9jkvb7XZJG6DImVhz8BSELBT2mLdo=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "76567ee28dacac2636aeb6e5b6a9560ffca21d87",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
16
flake.nix
16
flake.nix
|
@ -44,7 +44,6 @@
|
||||||
fpc.rustc
|
fpc.rustc
|
||||||
fpc.clippy
|
fpc.clippy
|
||||||
fpc.rust-src
|
fpc.rust-src
|
||||||
fpc.rustc
|
|
||||||
fpc.rustfmt
|
fpc.rustfmt
|
||||||
fpc.rustc-codegen-cranelift-preview
|
fpc.rustc-codegen-cranelift-preview
|
||||||
])
|
])
|
||||||
|
@ -64,20 +63,13 @@
|
||||||
++ lib.optionals pkgs.stdenv.isDarwin [
|
++ lib.optionals pkgs.stdenv.isDarwin [
|
||||||
# Additional darwin specific inputs can be set here
|
# Additional darwin specific inputs can be set here
|
||||||
pkgs.libiconv
|
pkgs.libiconv
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
];
|
];
|
||||||
|
|
||||||
# Additional environment variables can be set directly
|
# Additional environment variables can be set directly
|
||||||
# MY_CUSTOM_VAR = "some value";
|
# MY_CUSTOM_VAR = "some value";
|
||||||
};
|
};
|
||||||
|
|
||||||
craneLibLLvmTools = craneLib.overrideToolchain (
|
|
||||||
fenix.packages.${system}.complete.withComponents [
|
|
||||||
"cargo"
|
|
||||||
"llvm-tools"
|
|
||||||
"rustc"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
# Build *just* the cargo dependencies, so we can reuse
|
# Build *just* the cargo dependencies, so we can reuse
|
||||||
# all of that work (e.g. via cachix) when running in CI
|
# all of that work (e.g. via cachix) when running in CI
|
||||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
@ -119,7 +111,10 @@
|
||||||
commonArgs
|
commonArgs
|
||||||
// {
|
// {
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
cargoClippyExtraArgs = ''
|
||||||
|
--all --all-targets -- --deny warnings -W clippy::nursery -W rust-2018-idioms \
|
||||||
|
-A clippy::future_not_send -A clippy::option_if_let_else -A clippy::or_fun_call
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -151,6 +146,7 @@
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
partitions = 1;
|
partitions = 1;
|
||||||
partitionType = "count";
|
partitionType = "count";
|
||||||
|
cargoExtraArgs = "--no-tests pass";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
33
justfile
33
justfile
|
@ -1,12 +1,23 @@
|
||||||
precommit:
|
|
||||||
cargo update
|
|
||||||
cargo check
|
|
||||||
cargo fmt
|
|
||||||
cargo t
|
|
||||||
cargo clippy --fix --allow-dirty
|
|
||||||
|
|
||||||
check:
|
check:
|
||||||
cargo update
|
just precommit-shared
|
||||||
nix flake update
|
nix flake update
|
||||||
nix flake check
|
nix flake check -v
|
||||||
cargo clippy --fix --allow-dirty
|
|
||||||
|
precommit:
|
||||||
|
just precommit-shared
|
||||||
|
cargo check
|
||||||
|
just test
|
||||||
|
|
||||||
|
alias t := test
|
||||||
|
test:
|
||||||
|
cargo t --no-fail-fast
|
||||||
|
|
||||||
|
precommit-shared:
|
||||||
|
cargo upgrade -v
|
||||||
|
cargo update
|
||||||
|
cargo fmt --all
|
||||||
|
just clippy
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
cargo clippy --all --fix --allow-dirty -- -W clippy::nursery -W rust-2018-idioms \
|
||||||
|
-A clippy::future_not_send -A clippy::option_if_let_else -A clippy::or_fun_call
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,22 +1,22 @@
|
||||||
use aide::{
|
use aide::{
|
||||||
axum::{
|
axum::{
|
||||||
routing::{get, get_with},
|
|
||||||
ApiRouter, IntoApiResponse,
|
ApiRouter, IntoApiResponse,
|
||||||
|
routing::{get, get_with},
|
||||||
},
|
},
|
||||||
openapi::{Info, OpenApi},
|
openapi::{Info, OpenApi},
|
||||||
redoc::Redoc,
|
redoc::Redoc,
|
||||||
transform::TransformOperation,
|
transform::TransformOperation,
|
||||||
};
|
};
|
||||||
use axum::{
|
use axum::{
|
||||||
|
BoxError, Extension, Json,
|
||||||
error_handling::HandleErrorLayer,
|
error_handling::HandleErrorLayer,
|
||||||
http::{Method, StatusCode},
|
http::{Method, StatusCode},
|
||||||
BoxError, Extension, Json,
|
|
||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::{env, net::SocketAddr, sync::Arc, time::Duration};
|
use std::{env, net::SocketAddr, sync::Arc, time::Duration};
|
||||||
use tower::{buffer::BufferLayer, limit::RateLimitLayer, ServiceBuilder};
|
use tower::{ServiceBuilder, buffer::BufferLayer, limit::RateLimitLayer};
|
||||||
use tower_governor::{
|
use tower_governor::{
|
||||||
governor::GovernorConfigBuilder, key_extractor::SmartIpKeyExtractor, GovernorLayer,
|
GovernorLayer, governor::GovernorConfigBuilder, key_extractor::SmartIpKeyExtractor,
|
||||||
};
|
};
|
||||||
use tower_http::{
|
use tower_http::{
|
||||||
compression::CompressionLayer,
|
compression::CompressionLayer,
|
||||||
|
@ -39,7 +39,7 @@ async fn serve_api(Extension(api): Extension<OpenApi>) -> impl IntoApiResponse {
|
||||||
Json(api)
|
Json(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn description_date(op: TransformOperation) -> TransformOperation {
|
fn description_date(op: TransformOperation<'_>) -> TransformOperation<'_> {
|
||||||
op.parameter_untyped("start", |p| {
|
op.parameter_untyped("start", |p| {
|
||||||
p.description("Start date range - Inclusive >= - ISO 8601")
|
p.description("Start date range - Inclusive >= - ISO 8601")
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue