diff --git a/frameworks/Rust/hyperlane/Cargo.lock b/frameworks/Rust/hyperlane/Cargo.lock index a985ec53d06..c4499f36835 100644 --- a/frameworks/Rust/hyperlane/Cargo.lock +++ b/frameworks/Rust/hyperlane/Cargo.lock @@ -541,9 +541,9 @@ checksum = "8b3b8be124d9169d8670598a31b575969b2830c93957cecfb1d75250d138680f" [[package]] name = "http-type" -version = "5.31.3" +version = "5.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc2e6c5ee5ea55187e53e1c4b057758456de92bf68d13787c859262ac8ff8d3" +checksum = "bf9c68f2b434de149524d6a0079a39c0614b03693f1f6290ee5f970dc45e913b" dependencies = [ "hex", "http-compress", @@ -559,9 +559,9 @@ dependencies = [ [[package]] name = "hyperlane" -version = "10.34.5" +version = "10.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1af0bbd93a017eee5a60ce4e420a0cdea4402be47cf2834226e72ae06eab8c" +checksum = "4b353542081e7bb17e8bf607866923e00605b0c620e5834dcc33fd67d379c912" dependencies = [ "http-type", "inventory", @@ -783,9 +783,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lombok-macros" -version = "1.13.21" +version = "1.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921205d493d884b1ddc6d651d32c4fb3d89860cf56cf6176f14793fa31010bdf" +checksum = "496d4544842ef19f27e8d7725fce66f9d90178e9b0a0a527de7c886f8913d808" dependencies = [ "proc-macro2", "quote", @@ -994,18 +994,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" dependencies = [ "proc-macro2", ] @@ -1204,9 +1204,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", @@ -1532,9 +1532,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.113" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -1712,9 +1712,9 @@ checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "url" -version = "2.5.7" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", diff --git a/frameworks/Rust/hyperlane/Cargo.toml b/frameworks/Rust/hyperlane/Cargo.toml index 8c6ec2bcabb..be32f545e7c 100644 --- a/frameworks/Rust/hyperlane/Cargo.toml +++ b/frameworks/Rust/hyperlane/Cargo.toml @@ -12,14 +12,14 @@ categories = ["network-programming", "web-programming"] exclude = ["target", "Cargo.lock", "sh", ".github", "logs", "**/*.log"] [dependencies] +rand = "0.9.2" futures = "0.3.31" -hyperlane = "10.34.5" -hyperlane-time = "0.7.16" num_cpus = "1.17.0" once_cell = "1.21.3" -rand = "0.9.2" -serde = "1.0.228" -serde_json = "1.0.148" +hyperlane = "10.35.1" +serde_json = "1.0.149" +hyperlane-time = "0.7.16" +serde = { version = "1.0.228", features = ["derive"] } sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres"] } [profile.dev] diff --git a/frameworks/Rust/hyperlane/src/route/impl.rs b/frameworks/Rust/hyperlane/src/route/impl.rs index 17a76e5c906..5c632f97527 100644 --- a/frameworks/Rust/hyperlane/src/route/impl.rs +++ b/frameworks/Rust/hyperlane/src/route/impl.rs @@ -6,6 +6,7 @@ impl ServerHook for JsonRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; let json: Value = json!({ KEY_MESSAGE: RESPONSEDATA_STR }); @@ -15,7 +16,7 @@ impl ServerHook for JsonRoute { ctx.send().await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -28,13 +29,14 @@ impl ServerHook for PlaintextRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; ctx.set_response_header(CONTENT_TYPE, TEXT_PLAIN).await; ctx.set_response_body(&RESPONSEDATA_BIN).await; let run = || async { ctx.send().await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -47,6 +49,7 @@ impl ServerHook for DbRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; let db_connection: &DbPoolConnection = get_db_connection(); let run = || async { let query_row: QueryRow = random_world_row(db_connection).await; @@ -56,7 +59,7 @@ impl ServerHook for DbRoute { .await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -69,6 +72,7 @@ impl ServerHook for QueryRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; let run = || async { let queries: Queries = ctx .try_get_request_query(QUERY_DB_QUERY_KEY) @@ -85,7 +89,7 @@ impl ServerHook for QueryRoute { .await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -98,6 +102,7 @@ impl ServerHook for FortunesRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; ctx.set_response_header( CONTENT_TYPE, &ContentType::format_content_type_with_charset(TEXT_HTML, UTF8), @@ -121,7 +126,7 @@ impl ServerHook for FortunesRoute { ctx.set_response_body(&res).await.send().await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -134,6 +139,7 @@ impl ServerHook for UpdateRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; let run = || async { let queries: Queries = ctx .try_get_request_query(UPDATE_DB_QUERY_KEY) @@ -149,7 +155,7 @@ impl ServerHook for UpdateRoute { .await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; @@ -162,6 +168,7 @@ impl ServerHook for CachedQueryRoute { } async fn handle(self, ctx: &Context) { + let request_config: RequestConfig = *REQUEST_CONFIG; let run = || async { let count: Queries = ctx .try_get_request_query(CACHE_QUERY_KEY) @@ -177,7 +184,7 @@ impl ServerHook for CachedQueryRoute { .await; }; run().await; - while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { + while ctx.http_from_stream(request_config).await.is_ok() { run().await; } ctx.closed().await; diff --git a/frameworks/Rust/hyperlane/src/route/mod.rs b/frameworks/Rust/hyperlane/src/route/mod.rs index 6d47ae6e8b4..5ad7dbf00b2 100644 --- a/frameworks/Rust/hyperlane/src/route/mod.rs +++ b/frameworks/Rust/hyperlane/src/route/mod.rs @@ -1,6 +1,8 @@ pub(crate) mod r#impl; +pub(crate) mod r#static; pub(crate) mod r#struct; +pub(crate) use r#static::*; pub(crate) use r#struct::*; use super::*; diff --git a/frameworks/Rust/hyperlane/src/route/static.rs b/frameworks/Rust/hyperlane/src/route/static.rs new file mode 100644 index 00000000000..e6782f02af0 --- /dev/null +++ b/frameworks/Rust/hyperlane/src/route/static.rs @@ -0,0 +1,3 @@ +use super::*; + +pub static REQUEST_CONFIG: Lazy = Lazy::new(RequestConfig::default);