pub fn new(
        tenant: String,
        session: Session,
        format: Format,
        stdin_rx: mpsc::Receiver<String>,
    ) -> Self {
        let map_line = move |line: &str| match format {
            Format::Json => serde_json::from_str(line)
                .map_err(|x| io::Error::new(io::ErrorKind::InvalidInput, x)),
            Format::Shell => {
                let data = RequestData::from_iter_safe(
                    std::iter::once("distant")
                        .chain(line.trim().split(' ').filter(|s| !s.trim().is_empty())),
                )
                .map_err(|x| io::Error::new(io::ErrorKind::InvalidInput, x));

                data.map(|x| Request::new(tenant.to_string(), vec![x]))
            }
        };
        let req_task = tokio::spawn(async move {
            process_outgoing_requests(session, stdin_rx, format, map_line).await
        });

        Self { req_task }
    }
/// Creates a new instance of a session for use in CLI interactions being fed input using
/// the provided receiver
Creates a new instance of a session for use in CLI interactions being fed input using
the provided receiver
Creates a new instance of a session for use in CLI interactions being fed input using the provided receiver
pub fn new(
        tenant: String,
        session: Session,
        format: Format,
        stdin_rx: mpsc::Receiver<String>,
    ) -> Self {
        let map_line = move |line: &str| match format {
            Format::Json => serde_json::from_str(line)
                .map_err(|x| io::Error::new(io::ErrorKind::InvalidInput, x)),
            Format::Shell => {
                let data = RequestData::from_iter_safe(
                    std::iter::once("distant")
                        .chain(line.trim().split(' ').filter(|s| !s.trim().is_empty())),
                )
                .map_err(|x| io::Error::new(io::ErrorKind::InvalidInput, x));
                data.map(|x| Request::new(tenant.to_string(), vec![x]))
            }
        };
        let req_task = tokio::spawn(async move {
            process_outgoing_requests(session, stdin_rx, format, map_line).await
        });
        Self { req_task }
    }
pub fn new ( tenant : String , session : Session , format : Format , stdin_rx : mpsc :: Receiver < String > , ) -> Self { let map_line = move | line : & str | match format { Format :: Json => serde_json :: from_str ( line ) . map_err ( | x | io :: Error :: new ( io :: ErrorKind :: InvalidInput , x ) ) , Format :: Shell => { let data = RequestData :: from_iter_safe ( std :: iter :: once ( " " ) . chain ( line . trim ( ) . split ( ' ' ) . filter ( | s | ! s . trim ( ) . is_empty ( ) ) ) , ) . map_err ( | x | io :: Error :: new ( io :: ErrorKind :: InvalidInput , x ) ) ; data . map ( | x | Request :: new ( tenant . to_string ( ) , vec ! [ x ] ) ) } } ; let req_task = tokio :: spawn ( async move { process_outgoing_requests ( session , stdin_rx , format , map_line ) . await } ) ; Self { req_task } }
Creates a new instance of a session for use in CLI interactions being fed input using
the provided receiver
Creates a new instance of a session for use in CLI interactions being fed input using the provided receiver
tenant
String
session
Session
format
Format
stdin_rx
mpsc::Receiver<String>