writeable/
either.rs
1use crate::*;
6use ::either::Either;
7
8impl<W0, W1> Writeable for Either<W0, W1>
10where
11 W0: Writeable,
12 W1: Writeable,
13{
14 fn write_to<W: fmt::Write + ?Sized>(&self, sink: &mut W) -> fmt::Result {
15 match self {
16 Either::Left(w) => w.write_to(sink),
17 Either::Right(w) => w.write_to(sink),
18 }
19 }
20
21 fn write_to_parts<S: PartsWrite + ?Sized>(&self, sink: &mut S) -> fmt::Result {
22 match self {
23 Either::Left(w) => w.write_to_parts(sink),
24 Either::Right(w) => w.write_to_parts(sink),
25 }
26 }
27
28 fn writeable_length_hint(&self) -> LengthHint {
29 match self {
30 Either::Left(w) => w.writeable_length_hint(),
31 Either::Right(w) => w.writeable_length_hint(),
32 }
33 }
34
35 fn write_to_string(&self) -> Cow<str> {
36 match self {
37 Either::Left(w) => w.write_to_string(),
38 Either::Right(w) => w.write_to_string(),
39 }
40 }
41}