Skip to content

Make StatusCode::as_str return &'static str - #466

Closed
RAnders00 wants to merge 1 commit into
hyperium:masterfrom
RAnders00:patch-1
Closed

Make StatusCode::as_str return &'static str#466
RAnders00 wants to merge 1 commit into
hyperium:masterfrom
RAnders00:patch-1

Conversation

@RAnders00

@RAnders00 RAnders00 commented Feb 27, 2021

Copy link
Copy Markdown

The lifetime of the returned &str was implicitly pub fn as_str<'a>(&'a self) -> &'a str. This changes that to pub fn as_str<'a>(&'a self) -> &'static str. This would allow me to use the returned &str in my project without having to clone it into an owned String first.

@dekellum

This comment has been minimized.

@seanmonstar

Copy link
Copy Markdown
Member

Yea, this is a dupe. For reference, I've just started an issue (#468) to try to collect thoughts on the decision to make regarding this method.

@dekellum

dekellum commented Mar 3, 2021

Copy link
Copy Markdown
Contributor

Dup of #452 (for the record).

@RAnders00 RAnders00 closed this Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants