Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn parse_body(data: &str) -> Option<&str> {
- // Do stuff
- // ....
- Ok("xyz")
- }
- fn consume_data(req: HttpRequest<AppState>, body: bytes::Bytes) -> HttpResponse {
- let foo = parse_body(&body);
- // Do stuff
- HttpResponse::Ok().into()
- }
- use bytes::Bytes; // 0.4.10
- use std::str;
- fn example(b: &Bytes) -> Result<&str, str::Utf8Error> {
- str::from_utf8(b)
- }
Add Comment
Please, Sign In to add comment