File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -689,6 +689,15 @@ impl Buffer {
689689 }
690690 }
691691
692+ /// Checks if this buffer is ready to be flushed to a sender via one of the
693+ /// [`Sender::flush`] functions. An [`Ok`] value indicates that the buffer
694+ /// is ready to be flushed via a [`Sender`] while an [`Err`] will contain a
695+ /// message indicating why this [`Buffer`] cannot be flushed at the moment.
696+ #[ inline( always) ]
697+ pub fn check_can_flush ( & self ) -> Result < ( ) > {
698+ self . check_op ( Op :: Flush )
699+ }
700+
692701 #[ inline( always) ]
693702 fn validate_max_name_len ( & self , name : & str ) -> Result < ( ) > {
694703 if name. len ( ) > self . max_name_len {
@@ -2585,7 +2594,7 @@ impl Sender {
25852594 "Could not flush buffer: not connected to database."
25862595 ) ) ;
25872596 }
2588- buf. check_op ( Op :: Flush ) ?;
2597+ buf. check_can_flush ( ) ?;
25892598
25902599 if buf. len ( ) > self . max_buf_size {
25912600 return Err ( error:: fmt!(
You can’t perform that action at this time.
0 commit comments