Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ rustdoc-args = ["--cfg", "docsrs"]
maintenance = { status = "actively-developed" }

[features]
default = ["std"]
default = ["std", "blanket-component"]
std = []
# Enables derive(Bundle) and derive(Query)
macros = ["hecs-macros"]
# Enables the serialize::column module
column-serialize = ["serde"]
# Enables the serialize::row module
row-serialize = ["serde"]
# enables all T to implement Component
blanket-component = []

[dependencies]
hecs-macros = { path = "macros", version = "0.11.1", optional = true }
Expand Down
8 changes: 5 additions & 3 deletions src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,11 +1047,13 @@ impl From<NoSuchEntity> for QueryOneError {
}
}

/// Types that can be components, implemented automatically for all `Send + Sync + 'static` types
/// Types that can be components.
///
/// This is just a convenient shorthand for `Send + Sync + 'static`, and never needs to be
/// implemented manually.
/// With the default features enabled, Component is implemented for all `Send + Sync + 'static` types.
/// Otherwise, users must implement component for each type on their own.
pub trait Component: Send + Sync + 'static {}

#[cfg(feature = "blanket-component")]
impl<T: Send + Sync + 'static> Component for T {}

/// Iterator over all of a world's entities
Expand Down
Loading