Skip to content

Commit

Permalink
Merge pull request #571 from salsa-rs/davidbarsky/push-wpynvwnqotst
Browse files Browse the repository at this point in the history
chore: fix clippy lints
  • Loading branch information
davidbarsky authored Aug 29, 2024
2 parents 884a30c + df78f29 commit 9542a46
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/durability.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// Describes how likely a value is to change -- how "durable" it is.
/// Describes how likely a value is to change—how "durable" it is.
///
/// By default, inputs have `Durability::LOW` and interned values have
/// `Durability::HIGH`. But inputs can be explicitly set with other
/// durabilities.
Expand Down
1 change: 1 addition & 0 deletions src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub trait Configuration: Any {
}

/// Function ingredients are the "workhorse" of salsa.
///
/// They are used for tracked functions, for the "value" fields of tracked structs, and for the fields of input structs.
/// The function ingredient is fairly complex and so its code is spread across multiple modules, typically one per method.
/// The main entry points are:
Expand Down
1 change: 1 addition & 0 deletions src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::hash::Hash;
use std::num::NonZeroU32;

/// The `Id` of a salsa struct in the database [`Table`](`crate::table::Table`).
///
/// The higher-order bits of an `Id` identify a [`Page`](`crate::table::Page`)
/// and the low-order bits identify a slot within the page.
///
Expand Down
3 changes: 2 additions & 1 deletion src/interned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub struct JarImpl<C: Configuration> {
phantom: PhantomData<C>,
}

/// The interned ingredient has the job of hashing values of type `Data` to produce an `Id`.
/// The interned ingredient hashes values of type `Data` to produce an `Id`.
///
/// It used to store interned structs but also to store the id fields of a tracked struct.
/// Interned values endure until they are explicitly removed in some way.
pub struct IngredientImpl<C: Configuration> {
Expand Down
5 changes: 3 additions & 2 deletions src/revision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use std::sync::atomic::{AtomicUsize, Ordering};
/// because we want to use a `NonZeroUsize`.
const START: usize = 1;

/// A unique identifier for the current version of the database; each
/// time an input is changed, the revision number is incremented.
/// A unique identifier for the current version of the database.
///
/// Each time an input is changed, the revision number is incremented.
/// `Revision` is used internally to track which values may need to be
/// recomputed, but is not something you should have to interact with
/// directly as a user of salsa.
Expand Down
15 changes: 8 additions & 7 deletions src/tracked_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ pub trait TrackedStructInDb: SalsaStructInDb {
}

/// Created for each tracked struct.
/// This ingredient only stores the "id" fields.
/// It is a kind of "dressed up" interner;
/// the active query + values of id fields are hashed to create the tracked struct id.
/// The value fields are stored in [`crate::function::FunctionIngredient`] instances keyed by the tracked struct id.
/// Unlike normal interners, tracked struct indices can be deleted and reused aggressively:
/// when a tracked function re-executes,
/// any tracked structs that it created before but did not create this time can be deleted.
///
/// This ingredient only stores the "id" fields. It is a kind of "dressed up" interner;
/// the active query + values of id fields are hashed to create the tracked
/// struct id. The value fields are stored in [`crate::function::FunctionIngredient`]
/// instances keyed by the tracked struct id. Unlike normal interners, tracked
/// struct indices can be deleted and reused aggressively: when a tracked
/// function re-executes, any tracked structs that it created before but did
/// not create this time can be deleted.
pub struct IngredientImpl<C>
where
C: Configuration,
Expand Down
1 change: 1 addition & 0 deletions src/tracked_struct/tracked_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{ingredient::Ingredient, zalsa::IngredientIndex, Database, Id};
use super::{Configuration, Value};

/// Created for each tracked struct.
///
/// This ingredient only stores the "id" fields.
/// It is a kind of "dressed up" interner;
/// the active query + values of id fields are hashed to create the tracked struct id.
Expand Down
10 changes: 7 additions & 3 deletions src/zalsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ use crate::views::Views;
use crate::zalsa_local::ZalsaLocal;
use crate::{Database, DatabaseKeyIndex, Durability, Id, Revision};

/// Internal plumbing trait; implemented automatically when `#[salsa::db]`(`crate::db`) is attached to your database struct.
/// Contains methods that give access to the internal data from the `storage` field.
/// Internal plumbing trait.
///
/// [`ZalsaDatabase`] is created automatically when [`#[salsa::db]`](`crate::db`)
/// is attached to a database struct. it Contains methods that give access
/// to the internal data from the `storage` field.
///
/// # Safety
///
/// The system assumes this is implemented by a salsa procedural macro
/// which makes use of private data from the [`Storage`](`crate::storage::Storage`) struct.
/// Do not implement this yourself, instead, apply the [`salsa::db`](`crate::db`) macro
/// Do not implement this yourself, instead, apply the [`#[salsa::db]`](`crate::db`) macro
/// to your database.
pub unsafe trait ZalsaDatabase: Any {
/// Plumbing method: access both zalsa and zalsa-local at once.
Expand Down Expand Up @@ -61,6 +64,7 @@ pub struct StorageNonce;
static NONCE: NonceGenerator<StorageNonce> = NonceGenerator::new();

/// An ingredient index identifies a particular [`Ingredient`] in the database.
///
/// The database contains a number of jars, and each jar contains a number of ingredients.
/// Each ingredient is given a unique index as the database is being created.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
Expand Down

0 comments on commit 9542a46

Please sign in to comment.