aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-05-22 14:53:47 +0100
committerAleksey Kladov <[email protected]>2021-05-22 14:53:47 +0100
commit188b0f96f98feaa0771f941343887c46113c8ced (patch)
tree870d3afb3479ea9f0c323d7c539ce615ec4a4651 /crates/project_model
parente6776c3e1b66c8946873d20e1e3bc1d743c952fe (diff)
Add more docs
Diffstat (limited to 'crates/project_model')
-rw-r--r--crates/project_model/src/cargo_workspace.rs7
-rw-r--r--crates/project_model/src/lib.rs17
-rw-r--r--crates/project_model/src/project_json.rs7
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
3use std::path::PathBuf; 3use std::path::PathBuf;
4use std::{convert::TryInto, ops, process::Command, sync::Arc}; 4use std::{convert::TryInto, ops, process::Command, sync::Arc};
@@ -12,10 +12,9 @@ use rustc_hash::FxHashMap;
12use serde::Deserialize; 12use serde::Deserialize;
13use serde_json::from_value; 13use serde_json::from_value;
14 14
15use crate::build_data::BuildDataConfig; 15use crate::{build_data::BuildDataConfig, utf8_stdout};
16use 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
3mod cargo_workspace; 18mod cargo_workspace;
4mod cfg_flag; 19mod 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
3use std::path::PathBuf; 8use std::path::PathBuf;
4 9