Skip to content

Commit 7b36b44

Browse files
committed
feat(http/body-eos): EosRef<'a, E>: Clone + Copy
this commit introduces clone and copy implementations for the `EosRef<'a, E>` type used to inspect and classify the outcome of a request or response body. as the documentation comment notes in the commit below, this enum only contains immutable references to other values: a header map or an error. other variants are empty tags. ```rust pub enum EosRef<'a, E = Error> { None, Trailers(&'a HeaderMap), Error(&'a E), Cancelled, } ``` this commit makes this type implicitly clonable. Signed-off-by: katelyn martin <kate@buoyant.io>
1 parent 7b3f752 commit 7b36b44

File tree

1 file changed

+13
-0
lines changed
  • linkerd/http/body-eos/src

1 file changed

+13
-0
lines changed

linkerd/http/body-eos/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,16 @@ where
130130
};
131131
}
132132
}
133+
134+
// === impl EosRef ===
135+
136+
/// A reference to the end of a stream can be cheaply cloned.
137+
///
138+
/// Each of the variants are empty tags, or immutable references.
139+
impl<'a, E> Clone for EosRef<'a, E> {
140+
fn clone(&self) -> Self {
141+
*self
142+
}
143+
}
144+
145+
impl<'a, E> Copy for EosRef<'a, E> {}

0 commit comments

Comments
 (0)