pub async fn write_to<T: AsyncWrite + Unpin + Send>(
        &self,
        header: &Header,
        stream: &mut T,
    ) -> Result<()> {
        let mut writer = BufWriter::new(stream);
        header.write_to(&mut writer).await?;
        writer.write_u32(self.flags.bits()).await?;
        writer.write_all(self.collection.as_bytes()).await?;
        writer.write_u8(0).await?;
        writer.write_i32(self.skip).await?;
        writer.write_i32(self.limit).await?;
        let mut query = Vec::new();
        self.query.to_writer(&mut query)?;
        writer.write_all(&query).await?;
        if let Some(selector) = &self.selector {
            let mut s = Vec::new();
            selector.to_writer(&mut s)?;
            writer.write_all(&s).await?;
        }
        writer.flush().await?;
        Ok(())
    }
/// Serializes the Message to bytes and writes them to `writer`.
Serializes the Message to bytes and writes them to `writer`.
Serializes the Message to bytes and writes them to ` writer ` .
pub async fn write_to<T: AsyncWrite + Unpin + Send>(
        &self,
        header: &Header,
        stream: &mut T,
    ) -> Result<()> {
        let mut writer = BufWriter::new(stream);
        header.write_to(&mut writer).await?;
        writer.write_u32(self.flags.bits()).await?;
        writer.write_all(self.collection.as_bytes()).await?;
        writer.write_u8(0).await?;
        writer.write_i32(self.skip).await?;
        writer.write_i32(self.limit).await?;
        let mut query = Vec::new();
        self.query.to_writer(&mut query)?;
        writer.write_all(&query).await?;
        if let Some(selector) = &self.selector {
            let mut s = Vec::new();
            selector.to_writer(&mut s)?;
            writer.write_all(&s).await?;
        }
        writer.flush().await?;
        Ok(())
    }
pub async fn write_to < T : AsyncWrite + Unpin + Send > ( & self , header : & Header , stream : & mut T , ) -> Result < ( ) > { let mut writer = BufWriter :: new ( stream ) ; header . write_to ( & mut writer ) . await ? ; writer . write_u32 ( self . flags . bits ( ) ) . await ? ; writer . write_all ( self . collection . as_bytes ( ) ) . await ? ; writer . write_u8 ( 0 ) . await ? ; writer . write_i32 ( self . skip ) . await ? ; writer . write_i32 ( self . limit ) . await ? ; let mut query = Vec :: new ( ) ; self . query . to_writer ( & mut query ) ? ; writer . write_all ( & query ) . await ? ; if let Some ( selector ) = & self . selector { let mut s = Vec :: new ( ) ; selector . to_writer ( & mut s ) ? ; writer . write_all ( & s ) . await ? ; } writer . flush ( ) . await ? ; Ok ( ( ) ) }
Serializes the Message to bytes and writes them to `writer`.
Serializes the Message to bytes and writes them to ` writer ` .
&self
header
&Header
stream
&mut T
&self
header
&Header
stream
&mut T