Skip to content

Commit f53ceed

Browse files
committed
Implement From<PathAndQuery> for Bytes
This allows getting a `Bytes` instance from a `PathAndQuery` without any copying.
1 parent 78e3d37 commit f53ceed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/uri/path.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ impl hash::Hash for PathAndQuery {
348348
}
349349
}
350350

351+
impl From<PathAndQuery> for Bytes {
352+
fn from(value: PathAndQuery) -> Self {
353+
value.data.into()
354+
}
355+
}
356+
351357
// ===== PartialEq / PartialOrd =====
352358

353359
impl PartialEq for PathAndQuery {

0 commit comments

Comments
 (0)