[−][src]Macro slimweb::implwrite
Generic impl Write macro.
Example:
ⓘThis example is not tested
implwrite!(Stream, (Http .get_mut(), #[cfg(feature = "tls")] Https .get_mut()));
Becomes:
ⓘThis example is not tested
impl Write for Stream { fn write(&mut self, buf: &[u8]) -> IoResult<usize> { match self { Stream::Http(s) => s.get_mut().write(buf), #[cfg(feature = "tls")] Stream::Https(s) => s.get_mut().write(buf), } } fn flush(&mut self) -> IoResult<()> { match self { Stream::Http(s) => s.get_mut().flush(), #[cfg(feature = "tls")] Stream::Https(s) => s.get_mut().flush(), } } }