From 6ee949138712de4641414c0b1abb0b09f2d809be 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 058aae07..0fec9f8d 100644 --- a/src/uri/path.rs +++ b/src/uri/path.rs @@ -377,6 +377,12 @@ impl hash::Hash for PathAndQuery { } } +impl From for Bytes { + fn from(value: PathAndQuery) -> Self { + value.data.into() + } +} + // ===== PartialEq / PartialOrd ===== impl PartialEq for PathAndQuery {