@@ -11,12 +11,11 @@ Matsakis.
1111
1212> As of <!-- date-check --> November 2022, although ` Salsa ` is inspired by (among
1313> 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
1515> extensively in [ ` rust-analyzer ` ] , the official implementation of the language
1616> server protocol for Rust, but there are no medium or long-term concrete
1717> plans to integrate it into the compiler.
1818
19-
2019[ `rust-analyzer` ] : https://rust-analyzer.github.io/
2120[ chalk ] : https://rust-lang.github.io/chalk/book/what_is_chalk.html
2221
@@ -33,12 +32,11 @@ The objectives of `Salsa` are:
3332 results as if it had been done from scratch.
3433
3534` 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.
4240
4341## How does it work?
4442
@@ -50,8 +48,8 @@ something that the library produces, but, for each derived value there's a
5048"pure" function that computes the derived value.
5149
5250For 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.
5553
5654This means that when you try to compute with the library, ` Salsa ` is going to
5755compute 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.
120118The database is formed by combining query groups. Query groups are akin to
121119"` Salsa ` modules".
122120
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 ` .
124122
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
126124(` #[salsa::query_group(...)] ` ) has to be created.
127125
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.
130128
131129Example input query group:
132130
@@ -188,11 +186,11 @@ fn ast(db: &impl Parser, name: String) -> String {
188186```
189187
190188Eventually, after all the query groups have been defined, the database can be
191- created by declaring a struct.
189+ created by declaring a ` struct ` .
192190
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** .
196194
197195``` rust,ignore
198196///This attribute specifies which query groups are going to be in the database
0 commit comments