gix_packetline/line/
blocking_io.rsuse std::io;
use crate::{encode, BandRef, Channel, ErrorRef, PacketLineRef, TextRef};
impl BandRef<'_> {
pub fn write_to(&self, out: impl io::Write) -> io::Result<usize> {
match self {
BandRef::Data(d) => encode::band_to_write(Channel::Data, d, out),
BandRef::Progress(d) => encode::band_to_write(Channel::Progress, d, out),
BandRef::Error(d) => encode::band_to_write(Channel::Error, d, out),
}
}
}
impl TextRef<'_> {
pub fn write_to(&self, out: impl io::Write) -> io::Result<usize> {
encode::text_to_write(self.0, out)
}
}
impl ErrorRef<'_> {
pub fn write_to(&self, out: impl io::Write) -> io::Result<usize> {
encode::error_to_write(self.0, out)
}
}
impl PacketLineRef<'_> {
pub fn write_to(&self, out: impl io::Write) -> io::Result<usize> {
match self {
PacketLineRef::Data(d) => encode::data_to_write(d, out),
PacketLineRef::Flush => encode::flush_to_write(out),
PacketLineRef::Delimiter => encode::delim_to_write(out),
PacketLineRef::ResponseEnd => encode::response_end_to_write(out),
}
}
}