pub enum ContentEvent<'a> {
Upload(UploadHead),
UploadContent(&'a [u8]),
UploadEnd,
End,
Incomplete,
}Expand description
One step through a body, for the caller to act on. It is exhaustive, so that a caller can match it without a wildcard; adding an event is a breaking change.
Fields other than uploads are buffered by the parser and reported only when parsing finishes. An accepted upload produces Upload, any number of UploadContent, and UploadEnd, after which the caller must give the parser a handle for what it stored with ContentParser::store before parsing on. A body ends with End.
Variants§
Upload(UploadHead)
An upload a declared field accepts begins. The caller should prepare storage for its content.
UploadContent(&'a [u8])
Some of the current upload’s content, borrowed from the input, for the caller to store. An upload’s content may arrive in any number of pieces.
UploadEnd
The current upload’s content is complete. The caller must give its handle with ContentParser::store.
End
The body is complete. Any input after it, a multipart body’s epilogue, must still be given to later calls, which consume it within the epilogue limit and the body’s maximum and report End again, or to ContentParser::parse_end.
Incomplete
The input ends before the next event: call again with more input, beginning with the bytes not yet consumed, or finish when the body has ended.
Trait Implementations§
Source§impl<'a> Clone for ContentEvent<'a>
impl<'a> Clone for ContentEvent<'a>
Source§impl Debug for ContentEvent<'_>
Shows the length of content rather than its bytes, since an upload’s content must not reach logs.
impl Debug for ContentEvent<'_>
Shows the length of content rather than its bytes, since an upload’s content must not reach logs.