Skip to content

Commit 78ac5cf

Browse files
committed
docs(web): unmention try_init_service
1 parent 4303dd8 commit 78ac5cf

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

actix-http/examples/actix-web.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use actix_http::HttpService;
22
use actix_server::Server;
33
use actix_service::map_config;
4-
use actix_web::{dev::AppConfig, get, App};
4+
use actix_web::{dev::AppConfig, get, App, Responder};
55

66
#[get("/")]
7-
async fn index() -> &'static str {
7+
async fn index() -> impl Responder {
88
"Hello, world. From Actix Web!"
99
}
1010

actix-http/examples/echo.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ async fn main() -> io::Result<()> {
2323
body.extend_from_slice(&item?);
2424
}
2525

26-
info!("request body: {:?}", body);
26+
info!("request body: {body:?}");
2727

2828
let res = Response::build(StatusCode::OK)
2929
.insert_header(("x-head", HeaderValue::from_static("dummy value!")))
3030
.body(body);
3131

3232
Ok::<_, Error>(res)
3333
})
34-
// No TLS
35-
.tcp()
34+
.tcp() // No TLS
3635
})?
3736
.run()
3837
.await

actix-http/examples/hello-world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async fn main() -> io::Result<()> {
1717
ext.insert(42u32);
1818
})
1919
.finish(|req: Request| async move {
20-
info!("{:?}", req);
20+
info!("{req:?}");
2121

2222
let mut res = Response::build(StatusCode::OK);
2323
res.insert_header(("x-head", HeaderValue::from_static("dummy value!")));

actix-http/examples/streaming-error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ async fn main() -> io::Result<()> {
2222
.bind("streaming-error", ("127.0.0.1", 8080), || {
2323
HttpService::build()
2424
.finish(|req| async move {
25-
info!("{:?}", req);
25+
info!("{req:?}");
2626
let res = Response::ok();
2727

2828
Ok::<_, Infallible>(res.set_body(BodyStream::new(stream! {
2929
yield Ok(Bytes::from("123"));
3030
yield Ok(Bytes::from("456"));
3131

32-
actix_rt::time::sleep(Duration::from_millis(1000)).await;
32+
actix_rt::time::sleep(Duration::from_secs(1)).await;
3333

34-
yield Err(io::Error::new(io::ErrorKind::Other, ""));
34+
yield Err(io::Error::new(io::ErrorKind::Other, "abc"));
3535
})))
3636
})
3737
.tcp()

actix-http/examples/ws.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use bytes::{Bytes, BytesMut};
1717
use bytestring::ByteString;
1818
use futures_core::{ready, Stream};
1919
use tokio_util::codec::Encoder;
20-
use tracing::{info, trace};
2120

2221
#[actix_rt::main]
2322
async fn main() -> io::Result<()> {
@@ -37,12 +36,12 @@ async fn main() -> io::Result<()> {
3736
}
3837

3938
async fn handler(req: Request) -> Result<Response<BodyStream<Heartbeat>>, Error> {
40-
info!("handshaking");
39+
tracing::info!("handshaking");
4140
let mut res = ws::handshake(req.head())?;
4241

4342
// handshake will always fail under HTTP/2
4443

45-
info!("responding");
44+
tracing::info!("responding");
4645
res.message_body(BodyStream::new(Heartbeat::new(ws::Codec::new())))
4746
}
4847

@@ -64,7 +63,7 @@ impl Stream for Heartbeat {
6463
type Item = Result<Bytes, Error>;
6564

6665
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
67-
trace!("poll");
66+
tracing::trace!("poll");
6867

6968
ready!(self.as_mut().interval.poll_tick(cx));
7069

actix-web/src/test/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//!
33
//! # Initializing A Test Service
44
//! - [`init_service`]
5-
//! - [`try_init_service`]
65
//!
76
//! # Off-The-Shelf Test Services
87
//! - [`ok_service`]

0 commit comments

Comments
 (0)