fn from_call(
        ctx: &AssistContext,
        call: &ast::CallExpr,
        path: &ast::Path,
        target_module: Option<hir::Module>,
        target: GeneratedFunctionTarget,
    ) -> Option<Self> {
        let needs_pub = target_module.is_some();
        let target_module = target_module.or_else(|| current_module(target.syntax(), ctx))?;
        let fn_name = fn_name(path)?;
        let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Func(call.clone()))?;

        let await_expr = call.syntax().parent().and_then(ast::AwaitExpr::cast);
        let is_async = await_expr.is_some();

        let (ret_type, should_focus_return_type) =
            make_return_type(ctx, &ast::Expr::CallExpr(call.clone()), target_module);

        Some(Self {
            target,
            fn_name,
            type_params,
            params,
            ret_type,
            should_focus_return_type,
            needs_pub,
            is_async,
        })
    }
/// Prepares a generated function that matches `call`.
/// The function is generated in `target_module` or next to `call`
Prepares a generated function that matches `call`.
The function is generated in `target_module` or next to `call`
Prepares a generated function that matches ` call ` . The function is generated in ` target_module ` or next to ` call `
fn from_call(
        ctx: &AssistContext,
        call: &ast::CallExpr,
        path: &ast::Path,
        target_module: Option<hir::Module>,
        target: GeneratedFunctionTarget,
    ) -> Option<Self> {
        let needs_pub = target_module.is_some();
        let target_module = target_module.or_else(|| current_module(target.syntax(), ctx))?;
        let fn_name = fn_name(path)?;
        let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Func(call.clone()))?;
        let await_expr = call.syntax().parent().and_then(ast::AwaitExpr::cast);
        let is_async = await_expr.is_some();
        let (ret_type, should_focus_return_type) =
            make_return_type(ctx, &ast::Expr::CallExpr(call.clone()), target_module);
        Some(Self {
            target,
            fn_name,
            type_params,
            params,
            ret_type,
            should_focus_return_type,
            needs_pub,
            is_async,
        })
    }
fn from_call ( ctx : & AssistContext , call : & ast :: CallExpr , path : & ast :: Path , target_module : Option < hir :: Module > , target : GeneratedFunctionTarget , ) -> Option < Self > { let needs_pub = target_module . is_some ( ) ; let target_module = target_module . or_else ( | | current_module ( target . syntax ( ) , ctx ) ) ? ; let fn_name = fn_name ( path ) ? ; let ( type_params , params ) = fn_args ( ctx , target_module , FuncExpr :: Func ( call . clone ( ) ) ) ? ; let await_expr = call . syntax ( ) . parent ( ) . and_then ( ast :: AwaitExpr :: cast ) ; let is_async = await_expr . is_some ( ) ; let ( ret_type , should_focus_return_type ) = make_return_type ( ctx , & ast :: Expr :: CallExpr ( call . clone ( ) ) , target_module ) ; Some ( Self { target , fn_name , type_params , params , ret_type , should_focus_return_type , needs_pub , is_async , } ) }
Prepares a generated function that matches `call`.
Prepares a generated function that matches ` call ` .
ctx
&AssistContext
call
&ast::CallExpr
path
&ast::Path
target_module
Option<hir::Module>
target
GeneratedFunctionTarget