Advertisement
Guest User

Untitled

a guest
Apr 4th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. enum Error {
  2. InvalidLoginOrPassword,
  3. Other,
  4. }
  5.  
  6. trait StatusOk {
  7. type Response;
  8. fn ok() -> Self::Response {
  9. Self::Response {
  10. code: 200
  11. }
  12. }
  13. }
  14.  
  15. struct LoginForm {
  16. code: i32
  17. }
  18.  
  19. impl StatusOk for LoginForm {
  20. type Response = Self;
  21. }
  22.  
  23. fn login<'a>(_username: &'a str, _password: &'a str) -> Result<LoginForm, Error> {
  24. Ok(LoginForm::ok())
  25. }
  26.  
  27. fn main() {
  28. login("Username", "Password");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement