Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rj00a committed Feb 7, 2024
1 parent a624d32 commit c3f011a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ bevy_ecs = { version = "0.12.1", features = ["multi-threaded"] }
bevy_tasks = "0.12.1"
divan = "0.1.11"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ The control flow of the entire program is then defined by the flow of events bet
- Structural changes to the world (such as entity despawning, component additions/removals, etc.) are mediated by events, allowing systems to hook into their occurrence.
- _Targeted events_ enable systems to efficiently filter events based on queries.
- Component types, event types, and systems are identified with generational indices, allowing them to be added and removed dynamically.
- The interface to the library does not rely on Rust's type system. `evenio` should also be usable in dynamic contexts such as scripting languages or plugins.
- A small set of dependencies and `no_std` support.
- Execute systems in parallel with [Rayon].
- Core of the library does not depend on Rust's type system.
- `no_std` support.

Features such as inter-system parallelism and event batching are planned but not yet implemented.

Expand Down
6 changes: 6 additions & 0 deletions src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ impl fmt::Display for GetError {
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for GetError {}

unsafe impl<Q> SystemParam for Fetcher<'_, Q>
Expand Down Expand Up @@ -461,6 +462,7 @@ impl fmt::Display for SingleError {
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for SingleError {}

/// Iterator over entities matching the query `Q`.
Expand Down Expand Up @@ -578,6 +580,7 @@ unsafe impl<Q: Query> Send for Iter<'_, Q> {}
unsafe impl<Q: Query> Sync for Iter<'_, Q> {}

#[cfg(feature = "rayon")]
#[cfg_attr(docsrs, doc(cfg(feature = "rayon")))]
pub use rayon_impl::*;

#[cfg(feature = "rayon")]
Expand Down Expand Up @@ -646,6 +649,7 @@ mod rayon_impl {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "rayon")))]
impl<'a, Q> IntoParallelIterator for Fetcher<'a, Q>
where
Q: Query,
Expand All @@ -660,6 +664,7 @@ mod rayon_impl {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "rayon")))]
impl<'a, Q> IntoParallelIterator for &'a Fetcher<'_, Q>
where
Q: ReadOnlyQuery,
Expand All @@ -674,6 +679,7 @@ mod rayon_impl {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "rayon")))]
impl<'a, Q: Query> IntoParallelIterator for &'a mut Fetcher<'_, Q>
where
Q: Query,
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#![cfg_attr(not(any(feature = "std", test)), no_std)]
#![warn(clippy::std_instead_of_alloc, clippy::std_instead_of_core)]
#![allow(clippy::len_without_is_empty, clippy::let_unit_value)]
// Run locally with `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --open`
#![cfg_attr(docsrs, feature(doc_cfg))]

extern crate alloc;

Expand Down Expand Up @@ -32,6 +34,7 @@ pub mod tutorial;
pub mod world;

#[cfg(feature = "rayon")]
#[cfg_attr(docsrs, doc(cfg(feature = "rayon")))]
pub use rayon;

/// For macros only.
Expand Down
3 changes: 3 additions & 0 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ impl fmt::Display for InitError {
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for InitError {}

/// The priority of a system relative to other systems that handle the same
Expand Down Expand Up @@ -1196,6 +1197,7 @@ unsafe impl SystemParam for &'_ SystemInfo {
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
unsafe impl<P: SystemParam> SystemParam for std::sync::Mutex<P> {
type State = P::State;

Expand Down Expand Up @@ -1224,6 +1226,7 @@ unsafe impl<P: SystemParam> SystemParam for std::sync::Mutex<P> {
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
unsafe impl<P: SystemParam> SystemParam for std::sync::RwLock<P> {
type State = P::State;

Expand Down

0 comments on commit c3f011a

Please sign in to comment.