diff --git a/http-body-util/src/collected.rs b/http-body-util/src/collected.rs index 31a02a4..5325f70 100644 --- a/http-body-util/src/collected.rs +++ b/http-body-util/src/collected.rs @@ -28,6 +28,13 @@ impl Collected { self.trailers.as_ref() } + /// If there is a trailers frame buffered, remove and return it. + /// + /// Returns `None` if the body contained no trailers. + pub fn take_trailers(&mut self) -> Option { + self.trailers.take() + } + /// Aggregate this buffered into a [`Buf`]. pub fn aggregate(self) -> impl Buf { self.bufs