pub struct MultipartParser { /* private fields */ }Expand description
Multipart parser (boundary-based).
Implementations§
Source§impl MultipartParser
impl MultipartParser
Sourcepub fn new(boundary: &str, config: MultipartConfig) -> Self
pub fn new(boundary: &str, config: MultipartConfig) -> Self
Create a new parser with the given boundary.
Sourcepub fn parse(&self, body: &[u8]) -> Result<Vec<Part>, MultipartError>
pub fn parse(&self, body: &[u8]) -> Result<Vec<Part>, MultipartError>
Parse all parts from the body.
Sourcepub fn parse_incremental(
&self,
buffer: &mut Vec<u8>,
state: &mut MultipartStreamState,
eof: bool,
) -> Result<Vec<Part>, MultipartError>
pub fn parse_incremental( &self, buffer: &mut Vec<u8>, state: &mut MultipartStreamState, eof: bool, ) -> Result<Vec<Part>, MultipartError>
Parse any newly-available parts from a streamed multipart buffer.
This method mutates buffer by draining bytes that were fully consumed.
It can be called repeatedly as new bytes arrive.
- Set
eof = falsewhile more chunks may still arrive. - Set
eof = trueon the final call to enforce that the stream ended on a valid multipart boundary.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultipartParser
impl RefUnwindSafe for MultipartParser
impl Send for MultipartParser
impl Sync for MultipartParser
impl Unpin for MultipartParser
impl UnwindSafe for MultipartParser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).