Skip to content

Commit f681a33

Browse files
committed
More API changes
1 parent 6e65bd6 commit f681a33

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

src/message/frontend.rs

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,35 +133,21 @@ pub fn copy_fail(message: &str, buf: &mut Vec<u8>) -> io::Result<()> {
133133
write_body(buf, |buf| buf.write_cstr(message))
134134
}
135135

136-
pub struct Describe<'a> {
137-
pub variant: u8,
138-
pub name: &'a str,
139-
}
140-
141-
impl<'a> Message for Describe<'a> {
142-
fn write(&self, buf: &mut Vec<u8>) -> Result<(), io::Error> {
143-
buf.push(b'D');
144-
write_body(buf, |buf| {
145-
buf.push(self.variant);
146-
buf.write_cstr(self.name)
147-
})
148-
}
149-
}
150-
151-
pub struct Execute<'a> {
152-
pub portal: &'a str,
153-
pub max_rows: i32,
136+
pub fn describe(variant: u8, name: &str, buf: &mut Vec<u8>) -> io::Result<()> {
137+
buf.push(b'D');
138+
write_body(buf, |buf| {
139+
buf.push(variant);
140+
buf.write_cstr(name)
141+
})
154142
}
155143

156-
impl<'a> Message for Execute<'a> {
157-
fn write(&self, buf: &mut Vec<u8>) -> Result<(), io::Error> {
158-
buf.push(b'E');
159-
write_body(buf, |buf| {
160-
try!(buf.write_cstr(self.portal));
161-
try!(buf.write_i32::<BigEndian>(self.max_rows));
162-
Ok(())
163-
})
164-
}
144+
pub fn execute(portal: &str, max_rows: i32, buf: &mut Vec<u8>) -> io::Result<()> {
145+
buf.push(b'E');
146+
write_body(buf, |buf| {
147+
try!(buf.write_cstr(portal));
148+
buf.write_i32::<BigEndian>(max_rows).unwrap();
149+
Ok(())
150+
})
165151
}
166152

167153
pub struct Parse<'a> {

0 commit comments

Comments
 (0)