/// Try to parse a buffer of bytes into the Request.
///
/// Returns byte offset in `buf` to start of HTTP body.
Try to parse a buffer of bytes into the Request.
Returns byte offset in `buf` to start of HTTP body.
Try to parse a buffer of bytes into the Request . Returns byte offset in ` buf ` to start of HTTP body .
pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
        let headers = mem::replace(&mut self.headers, &mut []);
        /* SAFETY: see `parse_headers_iter_uninit` guarantees */
        unsafe {
            let headers: *mut [Header] = headers;
            let headers = headers as *mut [MaybeUninit<Header>];
            match self.parse_with_uninit_headers(buf, &mut *headers) {
                Ok(Status::Complete(idx)) => Ok(Status::Complete(idx)),
                other => {
                    // put the original headers back
                    self.headers = &mut *(headers as *mut [Header]);
                    other
                },
            }
        }
    }
pub fn parse ( & mut self , buf : & ' b [ u8 ] ) -> Result < usize > { let headers = mem :: replace ( & mut self . headers , & mut [ ] ) ; /* SAFETY: see `parse_headers_iter_uninit` guarantees */ unsafe { let headers : * mut [ Header ] = headers ; let headers = headers as * mut [ MaybeUninit < Header > ] ; match self . parse_with_uninit_headers ( buf , & mut * headers ) { Ok ( Status :: Complete ( idx ) ) => Ok ( Status :: Complete ( idx ) ) , other => { // put the original headers back self . headers = & mut * ( headers as * mut [ Header ] ) ; other } , } } }
Try to parse a buffer of bytes into the Request.
Try to parse a buffer of bytes into the Request .
&mut self
buf
&'b [u8]