]> git.proxmox.com Git - rustc.git/blob - src/tools/rust-analyzer/crates/rust-analyzer/src/cli/symbols.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / tools / rust-analyzer / crates / rust-analyzer / src / cli / symbols.rs
1 //! Read Rust code on stdin, print syntax tree on stdout.
2 use ide::Analysis;
3
4 use crate::cli::{flags, read_stdin};
5
6 impl flags::Symbols {
7 pub fn run(self) -> anyhow::Result<()> {
8 let text = read_stdin()?;
9 let (analysis, file_id) = Analysis::from_single_file(text);
10 let structure = analysis.file_structure(file_id).unwrap();
11 for s in structure {
12 println!("{:?}", s);
13 }
14 Ok(())
15 }
16 }