Skip to content

Commit

Permalink
docs: fix root docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LechintanTudor committed Sep 1, 2024
1 parent 4be4a41 commit 8299329
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ default = ["std"]
std = ["rustc-hash/std"]
parallel = ["std", "dep:rayon"]

[lints.rust]
missing-docs = "warn"

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
cast-possible-truncation = "allow"
missing-errors-doc = "allow"
missing-panics-doc = "allow"
missing-safety_doc = "allow"
module-name-repetitions = "allow"
needless-doctest-main = "allow"
wildcard-imports = "allow"
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! based on [sparse sets](https://www.geeksforgeeks.org/sparse-set/).
//!
//! # Example
//!
//! ```rust
//! use sparsey::World;
//!
Expand Down
94 changes: 48 additions & 46 deletions src/query/query_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,54 @@ where
}
}

impl<'a, G, E> QueryAll<'a, G, (), E>
where
G: Query,
E: Query,
{
/// Applies an "include" filter to the query.
pub fn include<I>(self) -> QueryAll<'a, G, I, E>
where
I: Query,
{
let (include, include_info) = I::borrow_with_group_info(self.world);

QueryAll {
world: self.world,
get: self.get,
include,
exclude: self.exclude,
get_info: self.get_info,
include_info,
exclude_info: self.exclude_info,
}
}
}

impl<'a, G, I> QueryAll<'a, G, I, ()>
where
G: Query,
I: Query,
{
/// Applies an "exclude" filter to the query.
pub fn exclude<E>(self) -> QueryAll<'a, G, I, E>
where
E: Query,
{
let (exclude, exclude_info) = E::borrow_with_group_info(self.world);

QueryAll {
world: self.world,
get: self.get,
include: self.include,
exclude,
get_info: self.get_info,
include_info: self.include_info,
exclude_info,
}
}
}

impl<'a, G, I, E> QueryAll<'a, G, I, E>
where
G: Query,
Expand Down Expand Up @@ -163,52 +211,6 @@ where
}
}

impl<'a, G, E> QueryAll<'a, G, (), E>
where
G: Query,
E: Query,
{
pub fn include<I>(self) -> QueryAll<'a, G, I, E>
where
I: Query,
{
let (include, include_info) = I::borrow_with_group_info(self.world);

QueryAll {
world: self.world,
get: self.get,
include,
exclude: self.exclude,
get_info: self.get_info,
include_info,
exclude_info: self.exclude_info,
}
}
}

impl<'a, G, I> QueryAll<'a, G, I, ()>
where
G: Query,
I: Query,
{
pub fn exclude<E>(self) -> QueryAll<'a, G, I, E>
where
E: Query,
{
let (exclude, exclude_info) = E::borrow_with_group_info(self.world);

QueryAll {
world: self.world,
get: self.get,
include: self.include,
exclude,
get_info: self.get_info,
include_info: self.include_info,
exclude_info,
}
}
}

#[allow(clippy::into_iter_without_iter)]
impl<'a, G, I, E> IntoIterator for &'a mut QueryAll<'_, G, I, E>
where
Expand Down

0 comments on commit 8299329

Please sign in to comment.