pub fn from_single_file(text: String) -> (Analysis, FileId) {
        let mut host = AnalysisHost::default();
        let file_id = FileId(0);
        let mut file_set = FileSet::default();
        file_set.insert(file_id, VfsPath::new_virtual_path("/main.rs".to_string()));
        let source_root = SourceRoot::new_local(file_set);

        let mut change = Change::new();
        change.set_roots(vec![source_root]);
        let mut crate_graph = CrateGraph::default();
        // FIXME: cfg options
        // Default to enable test for single file.
        let mut cfg_options = CfgOptions::default();
        cfg_options.insert_atom("test".into());
        crate_graph.add_crate_root(
            file_id,
            Edition::Edition2018,
            None,
            cfg_options,
            Env::default(),
            Default::default(),
        );
        change.change_file(file_id, Some(Arc::new(text)));
        change.set_crate_graph(crate_graph);
        host.apply_change(change);
        (host.analysis(), file_id)
    }
// Creates an analysis instance for a single file, without any extenal
// dependencies, stdlib support or ability to apply changes. See
// `AnalysisHost` for creating a fully-featured analysis.
Creates an analysis instance for a single file, without any extenal
dependencies, stdlib support or ability to apply changes. See
`AnalysisHost` for creating a fully-featured analysis.
Creates an analysis instance for a single file without any extenal dependencies stdlib support or ability to apply changes . See ` AnalysisHost ` for creating a fully - featured analysis .
pub fn from_single_file(text: String) -> (Analysis, FileId) {
        let mut host = AnalysisHost::default();
        let file_id = FileId(0);
        let mut file_set = FileSet::default();
        file_set.insert(file_id, VfsPath::new_virtual_path("/main.rs".to_string()));
        let source_root = SourceRoot::new_local(file_set);
        let mut change = Change::new();
        change.set_roots(vec![source_root]);
        let mut crate_graph = CrateGraph::default();
        // FIXME: cfg options
        // Default to enable test for single file.
        let mut cfg_options = CfgOptions::default();
        cfg_options.insert_atom("test".into());
        crate_graph.add_crate_root(
            file_id,
            Edition::Edition2018,
            None,
            cfg_options,
            Env::default(),
            Default::default(),
        );
        change.change_file(file_id, Some(Arc::new(text)));
        change.set_crate_graph(crate_graph);
        host.apply_change(change);
        (host.analysis(), file_id)
    }
pub fn from_single_file ( text : String ) -> ( Analysis , FileId ) { let mut host = AnalysisHost :: default ( ) ; let file_id = FileId ( 0 ) ; let mut file_set = FileSet :: default ( ) ; file_set . insert ( file_id , VfsPath :: new_virtual_path ( " " . to_string ( ) ) ) ; let source_root = SourceRoot :: new_local ( file_set ) ; let mut change = Change :: new ( ) ; change . set_roots ( vec ! [ source_root ] ) ; let mut crate_graph = CrateGraph :: default ( ) ; // FIXME: cfg options // Default to enable test for single file. let mut cfg_options = CfgOptions :: default ( ) ; cfg_options . insert_atom ( " " . into ( ) ) ; crate_graph . add_crate_root ( file_id , Edition :: Edition2018 , None , cfg_options , Env :: default ( ) , Default :: default ( ) , ) ; change . change_file ( file_id , Some ( Arc :: new ( text ) ) ) ; change . set_crate_graph ( crate_graph ) ; host . apply_change ( change ) ; ( host . analysis ( ) , file_id ) }
Creates an analysis instance for a single file, without any extenal
dependencies, stdlib support or ability to apply changes.
Creates an analysis instance for a single file without any extenal dependencies stdlib support or ability to apply changes .
text
String