Skip to content

Commit 212d08c

Browse files
authored
Upgrade MSRV and dependencies (#157)
1 parent 7548f5c commit 212d08c

File tree

16 files changed

+63
-44
lines changed

16 files changed

+63
-44
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ authors = ["PHPER Framework Team", "jmjoy <jmjoy@apache.org>"]
3030
edition = "2021"
3131
license = "MulanPSL-2.0"
3232
repository = "https://github.com/phper-framework/phper"
33-
rust-version = "1.65"
33+
rust-version = "1.79"
3434

3535
[workspace.dependencies]
3636
phper = { version = "0.13.1", path = "./phper" }

examples/http-client/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ crate-type = ["lib", "cdylib"]
2323

2424
[dependencies]
2525
phper = { workspace = true }
26-
reqwest = { version = "0.11.18", features = ["blocking", "cookies"] }
27-
thiserror = "1.0.43"
26+
reqwest = { version = "0.12.5", features = ["blocking", "cookies"] }
27+
thiserror = "1.0.63"
2828

2929
[dev-dependencies]
3030
phper-test = { workspace = true }

examples/http-server/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ name = "http_server"
2222
crate-type = ["lib", "cdylib"]
2323

2424
[dependencies]
25-
hyper = { version = "0.14.27", features = ["http1", "runtime", "server"] }
26-
axum = "0.6.19"
25+
hyper = { version = "1.4.1", features = ["http1", "server"] }
26+
axum = "0.7.5"
2727
phper = { workspace = true }
28-
thiserror = "1.0.43"
29-
tokio = { version = "1.29.1", features = ["full"] }
30-
reqwest = { version = "0.11.18", features = ["blocking"] }
28+
thiserror = "1.0.63"
29+
tokio = { version = "1.39.2", features = ["full"] }
30+
reqwest = { version = "0.12.5", features = ["blocking"] }
3131

3232
[dev-dependencies]
3333
phper-test = { workspace = true }
34-
reqwest = "0.11.18"
34+
reqwest = "0.12.5"

examples/http-server/src/server.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010

1111
use crate::{errors::HttpServerError, request::new_request_object, response::new_response_object};
1212
use axum::{
13-
body::Body,
13+
body::{self, Body},
1414
http::{Request, Response, StatusCode},
1515
routing::any,
16-
Router, Server,
16+
Router,
1717
};
18-
use hyper::body;
1918
use phper::{
2019
alloc::ToRefOwned,
2120
classes::{ClassEntity, Visibility},
2221
functions::Argument,
2322
values::ZVal,
2423
};
25-
use std::{cell::RefCell, collections::HashMap, net::SocketAddr};
26-
use tokio::runtime::{self};
24+
use std::{cell::RefCell, collections::HashMap, error::Error, net::SocketAddr};
25+
use tokio::{net::TcpListener, runtime};
2726

2827
const HTTP_SERVER_CLASS_NAME: &str = "HttpServer\\HttpServer";
2928

@@ -95,7 +94,9 @@ pub fn make_server_class() -> ClassEntity<()> {
9594
let (parts, body) = req.into_parts();
9695

9796
// Read all request body content.
98-
let body = body::to_bytes(body).await.map_err(HttpServerError::new)?;
97+
let body = body::to_bytes(body, usize::MAX)
98+
.await
99+
.map_err(HttpServerError::new)?;
99100

100101
// Create PHP `HttpServer\HttpRequest` object.
101102
let mut request = new_request_object()?;
@@ -148,9 +149,9 @@ pub fn make_server_class() -> ClassEntity<()> {
148149
);
149150

150151
// Start the http server.
151-
let server = Server::bind(&addr).serve(app.into_make_service());
152-
153-
server.await
152+
let listener = TcpListener::bind(addr).await?;
153+
axum::serve(listener, app).await?;
154+
Ok::<_, Box<dyn Error>>(())
154155
};
155156

156157
// Build the tokio runtime, with the current thread scheduler, block on

phper-doc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ license = { workspace = true }
2323
phper = { workspace = true }
2424

2525
[dev-dependencies]
26-
thiserror = "1.0.43"
27-
reqwest = { version = "0.11.18", features = ["blocking", "cookies"] }
26+
thiserror = "1.0.63"
27+
reqwest = { version = "0.12.5", features = ["blocking", "cookies"] }

phper-doc/doc/_05_internal_types/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## DST & Owned Type
44

5-
In Rust, there are many types that appear in pairs, like [str](str) / [String](String),
5+
In Rust, there are many types that appear in pairs, like [str] / [String],
66
[OsStr](std::ffi::OsStr) / [OsString](std::ffi::OsString),
77
[CStr](std::ffi::CStr) / [CString](std::ffi::CString).
88

99
For example:
1010

11-
- [str](str): Dynamically sized type, implements `!Sized`, usually used with reference
11+
- [str]: Dynamically sized type, implements `!Sized`, usually used with reference
1212
notation, as `&str`.
13-
- [String](String): Ownership type, encapsulates a pointer to a heap memory allocation.
13+
- [String]: Ownership type, encapsulates a pointer to a heap memory allocation.
1414

1515
PHPER follows this design, there are the following types:
1616

phper-macros/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ license = { workspace = true }
2323
proc-macro = true
2424

2525
[dependencies]
26-
quote = "1.0.31"
27-
syn = { version = "2.0.26", features = ["full"] }
28-
proc-macro2 = "1.0.66"
26+
quote = "1.0.36"
27+
syn = { version = "2.0.72", features = ["full"] }
28+
proc-macro2 = "1.0.86"
2929

3030
[dev-dependencies]
31-
syn = { version = "2.0.26", features = ["full", "extra-traits"] }
31+
syn = { version = "2.0.72", features = ["full", "extra-traits"] }

phper-sys/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ repository = { workspace = true }
2020
license = { workspace = true }
2121

2222
[build-dependencies]
23-
bindgen = "0.69.1"
24-
cc = "1.0.79"
25-
regex = "1.5.6"
23+
bindgen = "0.69.4"
24+
cc = "1.1.7"
25+
regex = "1.10.6"

phper-test/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ license = { workspace = true }
2121

2222
[dependencies]
2323
fastcgi-client = "0.9.0"
24-
libc = "0.2.147"
25-
once_cell = "1.18.0"
24+
libc = "0.2.155"
25+
once_cell = "1.19.0"
2626
phper-macros = { workspace = true }
27-
tempfile = "3.6.0"
28-
tokio = { version = "1.29.1", features = ["full"] }
27+
tempfile = "3.11.0"
28+
tokio = { version = "1.39.2", features = ["full"] }
2929

3030
[package.metadata.docs.rs]
3131
rustdoc-args = ["--cfg", "docsrs"]

phper-test/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use tempfile::NamedTempFile;
2222

2323
pub struct Context {
2424
pub php_bin: String,
25+
#[allow(dead_code)]
2526
pub ini_content: String,
2627
}
2728

0 commit comments

Comments
 (0)