Skip to content

Commit 6e65bd6

Browse files
committed
Switch over some copy messages
1 parent afa2df2 commit 6e65bd6

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/message/frontend.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,14 @@ impl<'a> Message for CopyData<'a> {
123123
}
124124
}
125125

126-
pub struct CopyDone;
127-
128-
impl Message for CopyDone {
129-
fn write(&self, buf: &mut Vec<u8>) -> Result<(), io::Error> {
130-
buf.push(b'c');
131-
write_body(buf, |_| Ok(()))
132-
}
126+
pub fn copy_done(buf: &mut Vec<u8>) {
127+
buf.push(b'c');
128+
write_body(buf, |_| Ok::<(), io::Error>(())).unwrap();
133129
}
134130

135-
pub struct CopyFail<'a> {
136-
pub message: &'a str,
137-
}
138-
139-
impl<'a> Message for CopyFail<'a> {
140-
fn write(&self, buf: &mut Vec<u8>) -> Result<(), io::Error> {
141-
buf.push(b'f');
142-
write_body(buf, |buf| buf.write_cstr(self.message))
143-
}
131+
pub fn copy_fail(message: &str, buf: &mut Vec<u8>) -> io::Result<()> {
132+
buf.push(b'f');
133+
write_body(buf, |buf| buf.write_cstr(message))
144134
}
145135

146136
pub struct Describe<'a> {

0 commit comments

Comments
 (0)