mirror of https://github.com/fafhrd91/actix-web
remove internal DataFactory trait
This commit is contained in:
parent
9f02fe1f28
commit
3f49a5ce8f
|
@ -4,6 +4,13 @@
|
||||||
### Changed
|
### Changed
|
||||||
* Bumped `rand` to `0.8`
|
* Bumped `rand` to `0.8`
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* Deprecated `on_connect` methods have been removed. Prefer the new
|
||||||
|
`on_connect_ext` technique. [#1857]
|
||||||
|
|
||||||
|
[#1857]: https://github.com/actix/actix-web/pull/1857
|
||||||
|
|
||||||
|
|
||||||
## 2.2.0 - 2020-11-25
|
## 2.2.0 - 2020-11-25
|
||||||
### Added
|
### Added
|
||||||
* HttpResponse builders for 1xx status codes. [#1768]
|
* HttpResponse builders for 1xx status codes. [#1768]
|
||||||
|
|
|
@ -3,8 +3,6 @@ use std::io;
|
||||||
use bytes::{BufMut, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use http::Version;
|
use http::Version;
|
||||||
|
|
||||||
use crate::extensions::Extensions;
|
|
||||||
|
|
||||||
const DIGITS_START: u8 = b'0';
|
const DIGITS_START: u8 = b'0';
|
||||||
|
|
||||||
pub(crate) fn write_status_line(version: Version, n: u16, bytes: &mut BytesMut) {
|
pub(crate) fn write_status_line(version: Version, n: u16, bytes: &mut BytesMut) {
|
||||||
|
@ -56,18 +54,6 @@ impl<'a> io::Write for Writer<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait DataFactory {
|
|
||||||
fn set(&self, ext: &mut Extensions);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) struct Data<T>(pub(crate) T);
|
|
||||||
|
|
||||||
impl<T: Clone + 'static> DataFactory for Data<T> {
|
|
||||||
fn set(&self, ext: &mut Extensions) {
|
|
||||||
ext.insert(self.0.clone())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
|
|
Loading…
Reference in New Issue