@@ -11,12 +11,11 @@ Matsakis.
11
11
12
12
> As of <!-- date-check --> November 2022, although ` Salsa ` is inspired by (among
13
13
> other things) ` rustc ` 's query system, it is not used directly in ` rustc ` . It
14
- > _ is_ used in [ chalk] , an implementation of Rust's trait system, and
14
+ > _ is_ used in [ chalk] , an implementation of Rust's ` trait ` system, and
15
15
> extensively in [ ` rust-analyzer ` ] , the official implementation of the language
16
16
> server protocol for Rust, but there are no medium or long-term concrete
17
17
> plans to integrate it into the compiler.
18
18
19
-
20
19
[ `rust-analyzer` ] : https://rust-analyzer.github.io/
21
20
[ chalk ] : https://rust-lang.github.io/chalk/book/what_is_chalk.html
22
21
@@ -33,12 +32,11 @@ The objectives of `Salsa` are:
33
32
results as if it had been done from scratch.
34
33
35
34
` Salsa ` 's actual model is much richer, allowing many kinds of inputs and many
36
- different outputs.
37
- For example, integrating ` Salsa ` with an IDE could mean that the inputs could be
38
- the manifest (` Cargo.toml ` ), entire source files (` foo.rs ` ), snippets and so
39
- on; the outputs of such an integration could range from a binary executable, to
40
- lints, types (for example, if a user selects a certain variable and wishes to
41
- see its type), completions, etc.
35
+ different outputs. For example, integrating ` Salsa ` with an IDE could mean that
36
+ the inputs could be manifests (` Cargo.toml ` , ` rust-toolchain.toml ` ), entire
37
+ source files (` foo.rs ` ), snippets and so on. The outputs of such an integration
38
+ could range from a binary executable, to lints, types (for example, if a user
39
+ selects a certain variable and wishes to see its type), completions, etc.
42
40
43
41
## How does it work?
44
42
@@ -50,8 +48,8 @@ something that the library produces, but, for each derived value there's a
50
48
"pure" function that computes the derived value.
51
49
52
50
For example, there might be a function ` ast(x: Path) -> AST ` . The produced
53
- ` AST ` isn't a final value, it's an intermediate value that the library would
54
- use for the computation.
51
+ Abstract Syntax Tree ( ` AST ` ) isn't a final value, it's an intermediate value
52
+ that the library would use for the computation.
55
53
56
54
This means that when you try to compute with the library, ` Salsa ` is going to
57
55
compute various derived values, and eventually read the input and produce the
@@ -120,13 +118,13 @@ A query group is a set of queries which have been defined together as a unit.
120
118
The database is formed by combining query groups. Query groups are akin to
121
119
"` Salsa ` modules".
122
120
123
- A set of queries in a query group are just a set of methods in a trait.
121
+ A set of queries in a query group are just a set of methods in a ` trait ` .
124
122
125
- To create a query group a trait annotated with a specific attribute
123
+ To create a query group a ` trait ` annotated with a specific attribute
126
124
(` #[salsa::query_group(...)] ` ) has to be created.
127
125
128
- An argument must also be provided to said attribute as it will be used by Salsa
129
- to create a struct to be used later when the database is created.
126
+ An argument must also be provided to said attribute as it will be used by ` Salsa `
127
+ to create a ` struct ` to be used later when the database is created.
130
128
131
129
Example input query group:
132
130
@@ -188,11 +186,11 @@ fn ast(db: &impl Parser, name: String) -> String {
188
186
```
189
187
190
188
Eventually, after all the query groups have been defined, the database can be
191
- created by declaring a struct.
189
+ created by declaring a ` struct ` .
192
190
193
- To specify which query groups are going to be part of the database an attribute
194
- (` #[salsa::database(...)] ` ) must be added. The argument of said attribute is a
195
- list of identifiers, specifying the query groups ** storages** .
191
+ To specify which query groups are going to be part of the database an ` attribute `
192
+ (` #[salsa::database(...)] ` ) must be added. The argument of said ` attribute ` is a
193
+ list of ` identifiers ` , specifying the query groups ** storages** .
196
194
197
195
``` rust,ignore
198
196
///This attribute specifies which query groups are going to be in the database
0 commit comments