1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-12-02 19:32:24 +01:00

remove set_ prefix

This commit is contained in:
Denis Kayshev 2023-01-18 20:44:49 +03:00
parent 21219e0843
commit 7d281e543c
No known key found for this signature in database
GPG Key ID: B22A36F44C0F5E19

View File

@ -62,10 +62,10 @@ use crate::{
/// let app = App::new() /// let app = App::new()
/// .wrap( /// .wrap(
/// middleware::Compress::new() /// middleware::Compress::new()
/// .set_gzip_level(3) /// .gzip_level(3)
/// .set_deflate_level(1) /// .deflate_level(1)
/// .set_brotli_level(7) /// .brotli_level(7)
/// .set_zstd_level(10), /// .zstd_level(10),
/// ) /// )
/// .default_service(web::to(|| async { HttpResponse::Ok().body("hello world") })); /// .default_service(web::to(|| async { HttpResponse::Ok().body("hello world") }));
/// ``` /// ```
@ -124,7 +124,7 @@ impl Compress {
/// ///
/// The integer here is on a scale of 0-9. /// The integer here is on a scale of 0-9.
/// When going out of range, level 1 will be used. /// When going out of range, level 1 will be used.
pub fn set_deflate_level(mut self, value: u32) -> Self { pub fn deflate_level(mut self, value: u32) -> Self {
Rc::get_mut(&mut self.inner).unwrap().deflate = Some(value); Rc::get_mut(&mut self.inner).unwrap().deflate = Some(value);
self self
} }
@ -132,7 +132,7 @@ impl Compress {
/// ///
/// The integer here is on a scale of 0-9. /// The integer here is on a scale of 0-9.
/// When going out of range, level 1 will be used. /// When going out of range, level 1 will be used.
pub fn set_gzip_level(mut self, value: u32) -> Self { pub fn gzip_level(mut self, value: u32) -> Self {
Rc::get_mut(&mut self.inner).unwrap().gzip = Some(value); Rc::get_mut(&mut self.inner).unwrap().gzip = Some(value);
self self
} }
@ -140,7 +140,7 @@ impl Compress {
/// ///
/// The integer here is on a scale of 0-11. /// The integer here is on a scale of 0-11.
/// When going out of range, level 3 will be used. /// When going out of range, level 3 will be used.
pub fn set_brotli_level(mut self, value: u32) -> Self { pub fn brotli_level(mut self, value: u32) -> Self {
Rc::get_mut(&mut self.inner).unwrap().brotli = Some(value); Rc::get_mut(&mut self.inner).unwrap().brotli = Some(value);
self self
} }
@ -148,7 +148,7 @@ impl Compress {
/// ///
/// The integer here is on a scale of 0-22. /// The integer here is on a scale of 0-22.
/// When going out of range, level 3 will be used. /// When going out of range, level 3 will be used.
pub fn set_zstd_level(mut self, value: u32) -> Self { pub fn zstd_level(mut self, value: u32) -> Self {
Rc::get_mut(&mut self.inner).unwrap().zstd = Some(value); Rc::get_mut(&mut self.inner).unwrap().zstd = Some(value);
self self
} }
@ -419,7 +419,7 @@ mod tests {
const DATA: &str = const_str::repeat!(D, 100); const DATA: &str = const_str::repeat!(D, 100);
let app = test::init_service({ let app = test::init_service({
App::new().wrap(Compress::new().set_gzip_level(9)).route( App::new().wrap(Compress::new().gzip_level(9)).route(
"/compress", "/compress",
web::get().to(move || HttpResponse::Ok().body(DATA)), web::get().to(move || HttpResponse::Ok().body(DATA)),
) )