Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - asset: make HandleUntyped::id private #7076

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 7 additions & 2 deletions crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ impl<T: Asset> Clone for Handle<T> {
/// To convert back to a typed handle, use the [typed](HandleUntyped::typed) method.
#[derive(Debug)]
pub struct HandleUntyped {
/// An unique identifier to an Asset.
pub id: HandleId,
id: HandleId,
handle_type: HandleType,
}

Expand Down Expand Up @@ -352,6 +351,12 @@ impl HandleUntyped {
}
}

/// The ID of the asset.
#[inline]
pub fn id(&self) -> HandleId {
self.id
}

/// Creates a weak copy of this handle.
#[must_use]
pub fn clone_weak(&self) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/texture_atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ fn check_textures(
rpg_sprite_handles: ResMut<RpgSpriteHandles>,
asset_server: Res<AssetServer>,
) {
if let LoadState::Loaded =
asset_server.get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id))
if let LoadState::Loaded = asset_server
.get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id()))
{
state.set(AppState::Finished).unwrap();
}
Expand Down