Guest User

Untitled

a guest
Dec 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. pub fn parse_body(data: &str) -> Option<&str> {
  2. // Do stuff
  3. // ....
  4. Ok("xyz")
  5. }
  6.  
  7. fn consume_data(req: HttpRequest<AppState>, body: bytes::Bytes) -> HttpResponse {
  8. let foo = parse_body(&body);
  9. // Do stuff
  10. HttpResponse::Ok().into()
  11. }
  12.  
  13. use bytes::Bytes; // 0.4.10
  14. use std::str;
  15.  
  16. fn example(b: &Bytes) -> Result<&str, str::Utf8Error> {
  17. str::from_utf8(b)
  18. }
Add Comment
Please, Sign In to add comment