diff options
author | Aleksey Kladov <[email protected]> | 2021-05-22 14:53:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-05-22 14:53:47 +0100 |
commit | 188b0f96f98feaa0771f941343887c46113c8ced (patch) | |
tree | 870d3afb3479ea9f0c323d7c539ce615ec4a4651 /crates/project_model/src | |
parent | e6776c3e1b66c8946873d20e1e3bc1d743c952fe (diff) |
Add more docs
Diffstat (limited to 'crates/project_model/src')
-rw-r--r-- | crates/project_model/src/cargo_workspace.rs | 7 | ||||
-rw-r--r-- | crates/project_model/src/lib.rs | 17 | ||||
-rw-r--r-- | crates/project_model/src/project_json.rs | 7 |
3 files changed, 25 insertions, 6 deletions
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index 4a4996cf4..ad705c752 100644 --- a/crates/project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! See [`CargoWorkspace`]. |
2 | 2 | ||
3 | use std::path::PathBuf; | 3 | use std::path::PathBuf; |
4 | use std::{convert::TryInto, ops, process::Command, sync::Arc}; | 4 | use std::{convert::TryInto, ops, process::Command, sync::Arc}; |
@@ -12,10 +12,9 @@ use rustc_hash::FxHashMap; | |||
12 | use serde::Deserialize; | 12 | use serde::Deserialize; |
13 | use serde_json::from_value; | 13 | use serde_json::from_value; |
14 | 14 | ||
15 | use crate::build_data::BuildDataConfig; | 15 | use crate::{build_data::BuildDataConfig, utf8_stdout}; |
16 | use crate::utf8_stdout; | ||
17 | 16 | ||
18 | /// `CargoWorkspace` represents the logical structure of, well, a Cargo | 17 | /// [`CargoWorkspace`] represents the logical structure of, well, a Cargo |
19 | /// workspace. It pretty closely mirrors `cargo metadata` output. | 18 | /// workspace. It pretty closely mirrors `cargo metadata` output. |
20 | /// | 19 | /// |
21 | /// Note that internally, rust analyzer uses a different structure: | 20 | /// Note that internally, rust analyzer uses a different structure: |
diff --git a/crates/project_model/src/lib.rs b/crates/project_model/src/lib.rs index a5b35ed95..8c6cf94c2 100644 --- a/crates/project_model/src/lib.rs +++ b/crates/project_model/src/lib.rs | |||
@@ -1,4 +1,19 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! In rust-analyzer, we maintain a strict separation between pure abstract |
2 | //! semantic project model and a concrete model of a particular build system. | ||
3 | //! | ||
4 | //! Pure model is represented by the [`base_db::CrateGraph`] from another crate. | ||
5 | //! | ||
6 | //! In this crate, we are conserned with "real world" project models. | ||
7 | //! | ||
8 | //! Specifically, here we have a representation for a Cargo project | ||
9 | //! ([`CargoWorkspace`]) and for manually specified layout ([`ProjectJson`]). | ||
10 | //! | ||
11 | //! Roughly, the things we do here are: | ||
12 | //! | ||
13 | //! * Project discovery (where's the relevant Cargo.toml for the current dir). | ||
14 | //! * Custom build steps (`build.rs` code generation and compilation of | ||
15 | //! procedural macros). | ||
16 | //! * Lowering of concrete model to a [`base_db::CrateGraph`] | ||
2 | 17 | ||
3 | mod cargo_workspace; | 18 | mod cargo_workspace; |
4 | mod cfg_flag; | 19 | mod cfg_flag; |
diff --git a/crates/project_model/src/project_json.rs b/crates/project_model/src/project_json.rs index 41a2ac03e..e8f1aca61 100644 --- a/crates/project_model/src/project_json.rs +++ b/crates/project_model/src/project_json.rs | |||
@@ -1,4 +1,9 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! `rust-project.json` file format. |
2 | //! | ||
3 | //! This format is spiritually a serialization of [`base_db::CrateGraph`]. The | ||
4 | //! idea here is that people who do not use Cargo, can instead teach their build | ||
5 | //! system to generate `rust-project.json` which can be ingested by | ||
6 | //! rust-analyzer. | ||
2 | 7 | ||
3 | use std::path::PathBuf; | 8 | use std::path::PathBuf; |
4 | 9 | ||