Skip to content

Commit 0ab8ad5

Browse files
committed
Updated examples - enabled oxhttp, using latest mio pr
1 parent 1b904d4 commit 0ab8ad5

File tree

5 files changed

+27
-41
lines changed

5 files changed

+27
-41
lines changed

Cargo.lock

Lines changed: 12 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ opt-level = 2
1010
[patch.crates-io]
1111
mio = { git = "https://github.com/vita-rust/mio", branch = "vita" }
1212
tokio = { git = "https://github.com/vita-rust/tokio", branch = "vita" }
13-
socket2053 = { git = "https://github.com/vita-rust/socket2", branch = "v0.5.3-vita", package = "socket2", version = "0.5.3" }
14-
socket2049 = { git = "https://github.com/vita-rust/socket2", branch = "v0.4.9-vita", package = "socket2", version = "0.4.9" }
13+
14+
socket2053 = { git = "https://github.com/rust-lang/socket2", branch = "master", package = "socket2", version = "0.5.3" }
15+
socket2049 = { git = "https://github.com/rust-lang/socket2", branch = "v0.4.x", package = "socket2", version = "0.4.9" }
1516

1617
# Required for rustls
1718
ring = { git = "https://github.com/vita-rust/ring", branch = "v0.16.20-vita" }

crates/2-http-client/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ repository = "https://github.com/vita-rust/examples"
88
homepage = "https://github.com/vita-rust/examples/crates/2-http-client"
99

1010
[features]
11-
default = ["rustls", "shims"]
12-
shims = ["vita-newlib-shims"]
11+
default = ["rustls"]
1312
rustls = ["reqwest/rustls-tls", "oxhttp/rustls"]
1413
openssl = ["reqwest/native-tls"]
1514

@@ -18,9 +17,9 @@ anyhow = "1.0"
1817
libc = "0.2.149"
1918
reqwest = { version = "0.11", default-features = false, features = ["json"] }
2019
tokio = { version = "1", features = ["macros", "rt", "net"] }
21-
oxhttp = { version = "0.1.7", features = ["rustls"] }
20+
oxhttp = { version = "0.2.0-alpha.1", features = ["rustls", "webpki-roots"] }
2221
ureq = { version = "2.7.1", default-features = false, features = ["gzip"] }
23-
vita-newlib-shims = { version = "0.2", optional = true }
22+
vita-newlib-shims = { version = "0.3", features = ["fcntl"] }
2423

2524
[package.metadata.vita]
2625
title_id = "RUSTTEST2"

crates/2-http-client/src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(all(target_os = "vita", feature = "shims"))]
1+
#[cfg(all(target_os = "vita"))]
22
use vita_newlib_shims as _;
33

44
use oxhttp::{
@@ -17,6 +17,7 @@ fn main() -> anyhow::Result<()> {
1717
.enable_all()
1818
.build()?
1919
.block_on(async {
20+
println!(">>>");
2021
println!(">>> Trying oxhttp");
2122
let client = Client::new();
2223
let body = client
@@ -25,11 +26,12 @@ fn main() -> anyhow::Result<()> {
2526
.to_string()?;
2627
println!(">>> oxhttp response: {body}");
2728

28-
// Requires std to depend on the latest libc
29-
// println!(">>> Trying ureq");
30-
// let body = ureq::get("http://example.com").call()?;
31-
// println!(">>> Ureq response: {:?}", body);
29+
println!(">>>");
30+
println!(">>> Trying ureq");
31+
let res = ureq::get("http://example.com").call()?.into_string()?;
32+
println!(">>> Ureq response: {:?}", res);
3233

34+
println!(">>>");
3335
println!(">>> Trying reqwest");
3436
let body = reqwest::get("https://example.com").await?.text().await?;
3537
println!(">>> Reqwest response: {:#?}", body);

crates/3-sdl/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,13 @@ pub fn main() -> Result<(), String> {
211211
let available = controller_subsystem
212212
.num_joysticks()
213213
.map_err(|e| format!("can't enumerate joysticks: {}", e))?;
214-
let controller = (0..available)
214+
let _controller = (0..available)
215215
.find_map(|id| {
216216
if !controller_subsystem.is_game_controller(id) {
217217
return None;
218218
}
219219

220-
match controller_subsystem.open(id) {
221-
Ok(c) => Some(c),
222-
Err(e) => None,
223-
}
220+
controller_subsystem.open(id).ok()
224221
})
225222
.expect("Couldn't open any controller");
226223

0 commit comments

Comments
 (0)