From f53ceed46edc01b505974e562a1b075341a9e609 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 28 Aug 2023 14:48:52 +0200 Subject: [PATCH] Implement From for Bytes This allows getting a `Bytes` instance from a `PathAndQuery` without any copying. --- src/uri/path.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uri/path.rs b/src/uri/path.rs index be2cb65c..bfec0eb2 100644 --- a/src/uri/path.rs +++ b/src/uri/path.rs @@ -348,6 +348,12 @@ impl hash::Hash for PathAndQuery { } } +impl From for Bytes { + fn from(value: PathAndQuery) -> Self { + value.data.into() + } +} + // ===== PartialEq / PartialOrd ===== impl PartialEq for PathAndQuery {