pub struct Field<'a> { /* private fields */ }Expand description
One part of a streamed multipart/form-data body.
Borrowed from the parser, so only one field exists at a time: the body is a single stream and the parts are in it in order.
Implementations§
Source§impl Field<'_>
impl Field<'_>
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
The part’s own Content-Type, if it declared one.
Sourcepub async fn chunk(&mut self) -> Result<Option<Bytes>>
pub async fn chunk(&mut self) -> Result<Option<Bytes>>
The next slice of this field’s content, or None at its end.
Chunk boundaries follow whatever arrived from the network and carry no meaning: a field’s content is the concatenation of its chunks.
§Errors
If the body is malformed or ends inside the part.
Sourcepub async fn bytes(&mut self) -> Result<Bytes>
pub async fn bytes(&mut self) -> Result<Bytes>
Collect the whole field into memory.
§Errors
413 past MultipartStream::max_field_bytes, or whatever
chunk would have returned. The limit is checked as the
field is read, so an oversized field is refused partway rather than
after it has all been buffered.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Field<'a>
impl<'a> !Sync for Field<'a>
impl<'a> !UnwindSafe for Field<'a>
impl<'a> Freeze for Field<'a>
impl<'a> Send for Field<'a>
impl<'a> Unpin for Field<'a>
impl<'a> UnsafeUnpin for Field<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more