1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

multipart::Field renamed to MultipartField

This commit is contained in:
Nikolay Kim 2019-03-29 11:59:38 -07:00
parent 19a0b8046b
commit 709475b2bb
3 changed files with 16 additions and 13 deletions

View File

@ -1,5 +1,11 @@
# Changes # Changes
## [1.0.0-alpha.2] - 2019-03-29
### Changed
* multipart::Field renamed to MultipartField
## [1.0.0-alpha.1] - 2019-03-28 ## [1.0.0-alpha.1] - 2019-03-28
### Changed ### Changed

View File

@ -10,7 +10,7 @@ pub(crate) mod readlines;
pub use self::form::{Form, FormConfig}; pub use self::form::{Form, FormConfig};
pub use self::json::{Json, JsonConfig}; pub use self::json::{Json, JsonConfig};
pub use self::multipart::{Multipart, MultipartItem}; pub use self::multipart::{Multipart, MultipartField, MultipartItem};
pub use self::path::Path; pub use self::path::Path;
pub use self::payload::{Payload, PayloadConfig}; pub use self::payload::{Payload, PayloadConfig};
pub use self::query::Query; pub use self::query::Query;

View File

@ -39,7 +39,7 @@ pub struct Multipart {
/// Multipart item /// Multipart item
pub enum MultipartItem { pub enum MultipartItem {
/// Multipart field /// Multipart field
Field(Field), Field(MultipartField),
/// Nested multipart stream /// Nested multipart stream
Nested(Multipart), Nested(Multipart),
} }
@ -402,12 +402,9 @@ impl InnerMultipart {
)?)); )?));
self.item = InnerMultipartItem::Field(Rc::clone(&field)); self.item = InnerMultipartItem::Field(Rc::clone(&field));
Ok(Async::Ready(Some(MultipartItem::Field(Field::new( Ok(Async::Ready(Some(MultipartItem::Field(
safety.clone(), MultipartField::new(safety.clone(), headers, mt, field),
headers, ))))
mt,
field,
)))))
} }
} }
} }
@ -421,21 +418,21 @@ impl Drop for InnerMultipart {
} }
/// A single field in a multipart stream /// A single field in a multipart stream
pub struct Field { pub struct MultipartField {
ct: mime::Mime, ct: mime::Mime,
headers: HeaderMap, headers: HeaderMap,
inner: Rc<RefCell<InnerField>>, inner: Rc<RefCell<InnerField>>,
safety: Safety, safety: Safety,
} }
impl Field { impl MultipartField {
fn new( fn new(
safety: Safety, safety: Safety,
headers: HeaderMap, headers: HeaderMap,
ct: mime::Mime, ct: mime::Mime,
inner: Rc<RefCell<InnerField>>, inner: Rc<RefCell<InnerField>>,
) -> Self { ) -> Self {
Field { MultipartField {
ct, ct,
headers, headers,
inner, inner,
@ -466,7 +463,7 @@ impl Field {
} }
} }
impl Stream for Field { impl Stream for MultipartField {
type Item = Bytes; type Item = Bytes;
type Error = MultipartError; type Error = MultipartError;
@ -479,7 +476,7 @@ impl Stream for Field {
} }
} }
impl fmt::Debug for Field { impl fmt::Debug for MultipartField {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "\nMultipartField: {}", self.ct)?; writeln!(f, "\nMultipartField: {}", self.ct)?;
writeln!(f, " boundary: {}", self.inner.borrow().boundary)?; writeln!(f, " boundary: {}", self.inner.borrow().boundary)?;