bevyengine / bevyengine/bevy

Add an `iter_empty` for `RelationshipTarget`.

Open
#18,725 1 comment 0 reactions 0 assignees View on GitHub
A-ECS C-Usability D-Straightforward S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

Due to bevy's conventions, `Children` and similar components may not exist, and code should generally not treat them as required to exist. Therefore it is nice to be able to return an empty iterator when `Children` is missing.

## What solution would you like?

Add a `RelationshipTarget::iter_empty() -> Self::Collection::SourceIter` method.
This is supported by all `std` collections as all of them have a `Default` implementation for their iterators.

## What alternative(s) have you considered?

Don't add this method, since this might not be an universal trait for all iterators.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.