pub fn new(
        start_info: fcrunner::ComponentStartInfo,
    ) -> Result<(Self, ServerEnd<DirectoryMarker>), ComponentError> {
        let url =
            runner::get_resolved_url(&start_info).map_err(ComponentError::InvalidStartInfo)?;
        let name = Path::new(&url)
            .file_name()
            .ok_or_else(|| ComponentError::InvalidUrl)?
            .to_str()
            .ok_or_else(|| ComponentError::InvalidUrl)?
            .to_string();

        let args = runner::get_program_args(&start_info)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;
        // TODO validate args

        let binary = runner::get_program_binary(&start_info)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;

        let ns = start_info.ns.ok_or_else(|| ComponentError::MissingNamespace(url.clone()))?;
        let ns = ComponentNamespace::try_from(ns)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;

        let outgoing_dir =
            start_info.outgoing_dir.ok_or_else(|| ComponentError::MissingOutDir(url.clone()))?;

        Ok((
            Self {
                url: url,
                name: name,
                binary: binary,
                args: args,
                ns: ns,
                job: job_default().create_child_job().map_err(ComponentError::CreateJob)?,
            },
            outgoing_dir,
        ))
    }
/// Create new object using `ComponentStartInfo`.
/// On sucess returns self and outgoing_dir from `ComponentStartInfo`.
Create new object using `ComponentStartInfo`.
On sucess returns self and outgoing_dir from `ComponentStartInfo`.
Create new object using ` ComponentStartInfo ` . On sucess returns self and outgoing_dir from ` ComponentStartInfo ` .
pub fn new(
        start_info: fcrunner::ComponentStartInfo,
    ) -> Result<(Self, ServerEnd<DirectoryMarker>), ComponentError> {
        let url =
            runner::get_resolved_url(&start_info).map_err(ComponentError::InvalidStartInfo)?;
        let name = Path::new(&url)
            .file_name()
            .ok_or_else(|| ComponentError::InvalidUrl)?
            .to_str()
            .ok_or_else(|| ComponentError::InvalidUrl)?
            .to_string();
        let args = runner::get_program_args(&start_info)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;
        // TODO validate args
        let binary = runner::get_program_binary(&start_info)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;
        let ns = start_info.ns.ok_or_else(|| ComponentError::MissingNamespace(url.clone()))?;
        let ns = ComponentNamespace::try_from(ns)
            .map_err(|e| ComponentError::InvalidArgs(url.clone(), e.into()))?;
        let outgoing_dir =
            start_info.outgoing_dir.ok_or_else(|| ComponentError::MissingOutDir(url.clone()))?;
        Ok((
            Self {
                url: url,
                name: name,
                binary: binary,
                args: args,
                ns: ns,
                job: job_default().create_child_job().map_err(ComponentError::CreateJob)?,
            },
            outgoing_dir,
        ))
    }
pub fn new ( start_info : fcrunner :: ComponentStartInfo , ) -> Result < ( Self , ServerEnd < DirectoryMarker > ) , ComponentError > { let url = runner :: get_resolved_url ( & start_info ) . map_err ( ComponentError :: InvalidStartInfo ) ? ; let name = Path :: new ( & url ) . file_name ( ) . ok_or_else ( | | ComponentError :: InvalidUrl ) ? . to_str ( ) . ok_or_else ( | | ComponentError :: InvalidUrl ) ? . to_string ( ) ; let args = runner :: get_program_args ( & start_info ) . map_err ( | e | ComponentError :: InvalidArgs ( url . clone ( ) , e . into ( ) ) ) ? ; // TODO validate args let binary = runner :: get_program_binary ( & start_info ) . map_err ( | e | ComponentError :: InvalidArgs ( url . clone ( ) , e . into ( ) ) ) ? ; let ns = start_info . ns . ok_or_else ( | | ComponentError :: MissingNamespace ( url . clone ( ) ) ) ? ; let ns = ComponentNamespace :: try_from ( ns ) . map_err ( | e | ComponentError :: InvalidArgs ( url . clone ( ) , e . into ( ) ) ) ? ; let outgoing_dir = start_info . outgoing_dir . ok_or_else ( | | ComponentError :: MissingOutDir ( url . clone ( ) ) ) ? ; Ok ( ( Self { url : url , name : name , binary : binary , args : args , ns : ns , job : job_default ( ) . create_child_job ( ) . map_err ( ComponentError :: CreateJob ) ? , } , outgoing_dir , ) ) }
Create new object using `ComponentStartInfo`.
Create new object using ` ComponentStartInfo ` .
start_info
fcrunner::ComponentStartInfo
start_info
fcrunner::ComponentStartInfo