nats-io / nats.rs

Rust client for NATS, the cloud native messaging system.
Apache License 2.0
980 stars 159 forks source link

Allow construction of HeaderValue from String #1253

Open nazar-pc opened 2 months ago

nazar-pc commented 2 months ago

Proposed change

If there is already allocated String with valid contents, it should be possible to create HeaderValue without unnecessary re-allocation going through &str.

Use case

To improve efficiency

Contribution

No response

nazar-pc commented 2 months ago

Funnily enough, FromStr checks for new lines in HeaderValue and From<&str> doesn't. Is that a bug?

paolobarbolini commented 2 months ago

Funnily enough, FromStr checks for new lines in HeaderValue and From<&str> doesn't. Is that a bug?

🤷‍♂️ https://github.com/nats-io/nats-architecture-and-design/issues/236

Jarema commented 2 months ago

Hey! I will have a run over those validation next week to make them consistent and not affecting perf. HeaderValue from String is ok to add.