From 63e7d630f0be16664eb7faaf3688bd8a7de52251 Mon Sep 17 00:00:00 2001 From: tottoto Date: Sat, 17 Feb 2024 05:17:22 +0900 Subject: [PATCH] doc(header): add panics and safety section to document --- src/header/value.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/header/value.rs b/src/header/value.rs index fb2a5c33..479f13b4 100644 --- a/src/header/value.rs +++ b/src/header/value.rs @@ -198,6 +198,13 @@ impl HeaderValue { /// /// This function does NOT validate that illegal bytes are not contained /// within the buffer. + /// + /// ## Panics + /// In a debug build this will panic if `src` is not valid UTF-8. + /// + /// ## Safety + /// `src` must contain valid UTF-8. In a release build it is undefined + /// behaviour to call this with `src` that is not valid UTF-8. pub unsafe fn from_maybe_shared_unchecked(src: T) -> HeaderValue where T: AsRef<[u8]> + 'static,