pub fn from_single_file(text: String) -> (Analysis, FileId) {
        let mut host = AnalysisHost::default();
        let source_root = SourceRootId(0);
        let mut change = AnalysisChange::new();
        change.add_root(source_root, true);
        let mut crate_graph = CrateGraph::default();
        let file_id = FileId(0);
        // 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(),
            Default::default(),
        );
        change.add_file(source_root, file_id, "main.rs".into(), 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 source_root = SourceRootId(0);
        let mut change = AnalysisChange::new();
        change.add_root(source_root, true);
        let mut crate_graph = CrateGraph::default();
        let file_id = FileId(0);
        // 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(),
            Default::default(),
        );
        change.add_file(source_root, file_id, "main.rs".into(), 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 source_root = SourceRootId ( 0 ) ; let mut change = AnalysisChange :: new ( ) ; change . add_root ( source_root , true ) ; let mut crate_graph = CrateGraph :: default ( ) ; let file_id = FileId ( 0 ) ; // 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 ( ) , Default :: default ( ) , ) ; change . add_file ( source_root , file_id , " " . into ( ) , 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
text
String