writeable/
parts_write_adapter.rs
1use crate::*;
6
7#[derive(Debug)]
8#[allow(clippy::exhaustive_structs)] pub struct CoreWriteAsPartsWrite<W: fmt::Write + ?Sized>(pub W);
10
11impl<W: fmt::Write + ?Sized> fmt::Write for CoreWriteAsPartsWrite<W> {
12 #[inline]
13 fn write_str(&mut self, s: &str) -> fmt::Result {
14 self.0.write_str(s)
15 }
16
17 #[inline]
18 fn write_char(&mut self, c: char) -> fmt::Result {
19 self.0.write_char(c)
20 }
21}
22
23impl<W: fmt::Write + ?Sized> PartsWrite for CoreWriteAsPartsWrite<W> {
24 type SubPartsWrite = CoreWriteAsPartsWrite<W>;
25
26 #[inline]
27 fn with_part(
28 &mut self,
29 _part: Part,
30 mut f: impl FnMut(&mut Self::SubPartsWrite) -> fmt::Result,
31 ) -> fmt::Result {
32 f(self)
33 }
34}