Skip to content

Why is there no implementation of Responder for i64? #2677

Answered by SergioBenitez
J-Cake asked this question in Questions
Discussion options

You must be logged in to vote
  1. Why is it not implemented for most standard primitives?

It's not implemented because there's no obviously correct, semantically equivalent HTTP response to the primitives. In other words, it's not obvious what the correct HTTP response for an integer should be. Should it be the string representation of the integer? If so, what is the content-type, and in which base? Should it be a status code? Since it's not obvious, we can't implement Responder.

  1. How can I implement it? Keeping in mind that Rust won't allow the implementation of 3rd-party traits on 3rd-party types.

You cannot. How you go around this depends and what you want the responder to do when it is a PrimaryKey. If you want…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@J-Cake
Comment options

Answer selected by J-Cake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants