From 2b2781910465c150e4c86cc7086d8e48cd587dc6 Mon Sep 17 00:00:00 2001 From: pantonshire Date: Mon, 29 Aug 2022 11:16:10 +0100 Subject: [PATCH] Percent encode to String buffer --- src/encoding/rfc3986.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/encoding/rfc3986.rs b/src/encoding/rfc3986.rs index 0c63cd0..c005692 100644 --- a/src/encoding/rfc3986.rs +++ b/src/encoding/rfc3986.rs @@ -112,6 +112,15 @@ where } } +#[cfg(feature = "alloc")] +pub fn percent_encode_to_buf(buf: &mut String, bytes: &B) +where + B: AsRef<[u8]> + ?Sized, +{ + percent_encode_to_fmt_writer(buf, bytes) + .expect("writing to a String should never return an error") +} + pub fn percent_encode_to_fmt_writer(writer: &mut W, bytes: &B) -> fmt::Result where W: Write + ?Sized,