| 1 | use crate::message::{FrontendMessage, FrontendMessageFormat}; |
| 2 | use sqlx_core::Error; |
| 3 | use std::num::Saturating; |
| 4 | |
| 5 | /// The Flush message does not cause any specific output to be generated, |
| 6 | /// but forces the backend to deliver any data pending in its output buffers. |
| 7 | /// |
| 8 | /// A Flush must be sent after any extended-query command except Sync, if the |
| 9 | /// frontend wishes to examine the results of that command before issuing more commands. |
| 10 | #[derive(Debug)] |
| 11 | pub struct Flush; |
| 12 | |
| 13 | impl FrontendMessage for Flush { |
| 14 | const FORMAT: FrontendMessageFormat = FrontendMessageFormat::Flush; |
| 15 | |
| 16 | #[inline(always)] |
| 17 | fn body_size_hint(&self) -> Saturating<usize> { |
| 18 | Saturating(0) |
| 19 | } |
| 20 | |
| 21 | #[inline(always)] |
| 22 | fn encode_body(&self, _buf: &mut Vec<u8>) -> Result<(), Error> { |
| 23 | Ok(()) |
| 24 | } |
| 25 | } |