You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: client.rs
    path of file: ./repos/mprocs/src
    
    the code of the file until where you have to start completion: use crossterm::{
  cursor::SetCursorStyle,
  event::{DisableMouseCapture, EnableMouseCapture, Event, EventStream},
  execute,
  terminal::{
    disable_raw_mode, enable_raw_mode, Clear, ClearType, EnterAlternateScreen,
    LeaveAlternateScreen,
  },
};
use futures::{FutureExt, StreamExt};
use tokio::select;
use tui::backend::{Backend, CrosstermBackend};

use crate::{
  host::{
    receiver::MsgReceiver, sender::MsgSender, socket::connect_client_socket,
  },
  protocol::{CltToSrv, CursorStyle, SrvToClt},
};

pub async fn client_main(spawn_server: bool) -> anyhow::Result<()> {
  let (tx, rx) =
    connect_client_socket::<CltToSrv, SrvToClt>(spawn_server).await?;

  let res1 = match enable_raw_mode() {
    Ok(_) => {
      let res1 = match execute!(
        std::io::stdout(),
        Ent
    
pub async fn client_main(spawn_server: bool) -> anyhow::Result<()> {
  let (tx, rx) =
    connect_client_socket::<CltToSrv, SrvToClt>(spawn_server).await?;

  let res1 = match enable_raw_mode() {
    Ok(_) => {
      let res1 = match execute!(
        std::io::stdout(),
        EnterAlternateScreen,
        Clear(ClearType::All),
        EnableMouseCapture,
        // https://wezfurlong.org/wezterm/config/key-encoding.html#xterm-modifyotherkeys
        crossterm::style::Print("\x1b[>4;2m"),
      ) {
        Ok(_) => client_main_inner(tx, rx).await,
        Err(err) => Err(err.into()),
      };

      let res2 =
        execute!(std::io::stdout(), DisableMouseCapture, LeaveAlternateScreen);

      res1.and(res2.map_err(anyhow::Error::from))
    }
    Err(err) => Err(err.into()),
  };

  let res2 = disable_raw_mode().map_err(anyhow::Error::from);

  res1.and(res2)
}