Serializes this value to `buf` in the specified `format`.
(&self, ty: &Type, format: Format, buf: &mut BytesMut)
| 350 | |
| 351 | /// Serializes this value to `buf` in the specified `format`. |
| 352 | pub fn encode(&self, ty: &Type, format: Format, buf: &mut BytesMut) -> Result<(), io::Error> { |
| 353 | match format { |
| 354 | Format::Text => { |
| 355 | self.encode_text(buf); |
| 356 | Ok(()) |
| 357 | } |
| 358 | Format::Binary => self.encode_binary(ty, buf), |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /// Serializes this value to `buf` using the [text encoding |
| 363 | /// format](Format::Text). |