Future of StatusCode::as_str
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Refactorización
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- rust
- Área
- networking
Línea de trabajo
Comienza con el método StatusCode::as_str y lee los PRs referenciados #380, #436 y #466, junto con la discusión enlazada en #443. Compara los argumentos para conservar, cambiar, marcar como obsoleto o eliminar el método, incluido su coste en tamaño binario; se considera terminado cuando el proyecto tiene una dirección acordada y un seguimiento accionable.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I wanted to write-up some thoughts on the future direction for the StatusCode::as_str method. The as_str method returns the numeric part of the status code as a string slice. So, StatusCode::OK.as_str() returns "200", and StatusCode::NOT_FOUND.as_str() returns "404", and so forth. This works for all StatusCodes, from 100-999. Since the StatusCode only stores an integer, there's no field to actually borrow the string from, so it is in reality returning a &'static str, even though the method signature doesn't expose that.
There have been several PRs filed to make that part of the signature (that is, change from fn as_str(&self) -> &str to fn as_str(&self) -> &'static str) (#380 #436 #466).
I've personally questioned the value of the method in it's entirety:
I was thinking that perhaps we just axe
StatusCode::as_str, because really, how useful can it be? There's theDisplayimpl to get a string, and if you want a fast path for some common status codes, a user can just do that manually (hyper has a fast path forHTTP/1.1 200 OK, for instance).
That comment was prompted as I wondered about the cost of including all the static strings in the binary, when certainly most applications will never need them. Because I don't see value in the method, I've held off from changing it return a &'static str. Instead, I've thought we may just want to deprecate it and chop it for 1.0.
However, I realize I could be wrong, and not considering a large use case for this method. If so, we can just merge one of the PRs and carry on. If I have overlooked something, hopefully we can collect the reasons why to keep the method, with some details about the value it provides versus the cost of having a bunch of extra strings in the binary for everyone.
- Lenguaje dominante
- Rust
- Estrellas
- 1.4k
- Forks
- 385
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hyperium/http
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
Todos los issues de hyperium/http
Issues similares
-
BASEPRI needs an ISBAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
rust-embedded/cortex-m#702 · 1 comentario ·
-
Make major, minor, and makedev safe on solarish targetsPosiblemente ocupada @xtqqczze la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
improvement/feedback improvement/workflow-project
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
higress-group/HiRoute#166 ·
Los mantenedores suelen responder en 1 día
-
Proxy ignores l5d-retry-http and l5d-retry-grpc conditions that follow a comma and spacePosiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 3 días
-
sncast panics when decoding a `u384` valuePosiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
foundry-rs/starknet-foundry#4635 ·
Los mantenedores suelen responder en 3 días