Skip to content

Commit

Permalink
chore: deprecate ThinData
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Aug 9, 2024
1 parent 7e9759f commit 79306b6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion actix-web-lab/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Unreleased

- Implement `Clone` for `extract::Path<T: Clone>`.
- `header::CacheControl` now `Deref`s to a slice instead of a `Vec`.
- The `Deref` implementation for `header::CacheControl` now returns a slice instead of a `Vec`.
- Deprecate `extract::ThinData` now it has graduated to Actix Web.

## 0.21.0

Expand Down
7 changes: 2 additions & 5 deletions actix-web-lab/examples/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
use std::{convert::Infallible, io, time::Duration};

use actix_web::{get, middleware::Logger, App, HttpRequest, HttpServer, Responder};
#[allow(deprecated)]
use actix_web_lab::respond::Html;
use actix_web::{get, middleware::Logger, web::Html, App, HttpRequest, HttpServer, Responder};
use actix_web_lab::{extract::Path, sse};
use futures_util::stream;
use time::format_description::well_known::Rfc3339;
use tokio::time::sleep;

#[allow(deprecated)]
#[get("/")]
async fn index() -> impl Responder {
Html(include_str!("./assets/sse.html").to_string())
Html::new(include_str!("./assets/sse.html").to_string())
}

/// Countdown event stream starting from 8.
Expand Down
3 changes: 2 additions & 1 deletion actix-web-lab/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/// An alias for [`actix_web::web::Data<T>`] with a more descriptive name.
pub type SharedData<T> = actix_web::web::Data<T>;

#[allow(deprecated)]
pub use crate::thin_data::ThinData;
pub use crate::{
body_limit::{BodyLimit, DEFAULT_BODY_LIMIT},
bytes::{Bytes, DEFAULT_BYTES_LIMIT},
Expand All @@ -14,7 +16,6 @@ pub use crate::{
query::Query,
request_signature::{RequestSignature, RequestSignatureError, RequestSignatureScheme},
swap_data::SwapData,
thin_data::ThinData,
url_encoded_form::{UrlEncodedForm, DEFAULT_URL_ENCODED_FORM_LIMIT},
x_forwarded_prefix::ReconstructedPath,
};
3 changes: 3 additions & 0 deletions actix-web-lab/src/thin_data.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

use std::any::type_name;

use actix_utils::future::{ready, Ready};
Expand Down Expand Up @@ -37,6 +39,7 @@ use actix_web::{dev::Payload, error, FromRequest, HttpRequest};
/// # ;
/// ```
#[derive(Debug, Clone)]
#[deprecated(since = "0.22.0", note = "Graduated to Actix Web.")]
pub struct ThinData<T>(pub T);

impl_more::impl_as_ref!(ThinData<T> => T);
Expand Down

0 comments on commit 79306b6

Please sign in to comment.