pub fn extend<T: AsRef<[u8]>>(&mut self, tail: T, size_limit: Option<usize>) -> Result<()> {
        // Always have a max size. This ensures an error in case of concatenating two buffers
        // of more than `usize::max_value()` bytes in total.
        let max_size = size_limit.unwrap_or_else(usize::max_value);
        let my_size = self.len();
        let portion_size = tail.as_ref().len();
        // Be careful about integer overflows here.
        if my_size > max_size || portion_size > max_size - my_size {
            return Err(Error::Capacity(CapacityError::MessageTooLong {
                size: my_size + portion_size,
                max_size,
            }));
        }

        match self.collector {
            IncompleteMessageCollector::Binary(ref mut v) => {
                v.extend(tail.as_ref());
                Ok(())
            }
            IncompleteMessageCollector::Text(ref mut t) => t.extend(tail),
        }
    }
/// Add more data to an existing message.
Add more data to an existing message.
Add more data to an existing message .
pub fn extend<T: AsRef<[u8]>>(&mut self, tail: T, size_limit: Option<usize>) -> Result<()> {
        // Always have a max size. This ensures an error in case of concatenating two buffers
        // of more than `usize::max_value()` bytes in total.
        let max_size = size_limit.unwrap_or_else(usize::max_value);
        let my_size = self.len();
        let portion_size = tail.as_ref().len();
        // Be careful about integer overflows here.
        if my_size > max_size || portion_size > max_size - my_size {
            return Err(Error::Capacity(CapacityError::MessageTooLong {
                size: my_size + portion_size,
                max_size,
            }));
        }
        match self.collector {
            IncompleteMessageCollector::Binary(ref mut v) => {
                v.extend(tail.as_ref());
                Ok(())
            }
            IncompleteMessageCollector::Text(ref mut t) => t.extend(tail),
        }
    }
pub fn extend < T : AsRef < [ u8 ] > > ( & mut self , tail : T , size_limit : Option < usize > ) -> Result < ( ) > { // Always have a max size. This ensures an error in case of concatenating two buffers // of more than `usize::max_value()` bytes in total. let max_size = size_limit . unwrap_or_else ( usize :: max_value ) ; let my_size = self . len ( ) ; let portion_size = tail . as_ref ( ) . len ( ) ; // Be careful about integer overflows here. if my_size > max_size || portion_size > max_size - my_size { return Err ( Error :: Capacity ( CapacityError :: MessageTooLong { size : my_size + portion_size , max_size , } ) ) ; } match self . collector { IncompleteMessageCollector :: Binary ( ref mut v ) => { v . extend ( tail . as_ref ( ) ) ; Ok ( ( ) ) } IncompleteMessageCollector :: Text ( ref mut t ) => t . extend ( tail ) , } }
Add more data to an existing message.
Add more data to an existing message .
&mut self
tail
T
size_limit
Option<usize>
&mut self
tail
T
size_limit
Option<usize>