bevy/crates/bevy_asset/src
Weasy a2f0fe24e8 Allow String and &String as Id for AssetServer.get_handle(id) (#3280)
# Objective

Make it easier to build and use an asset path with `format!()`. This can be useful for accessing assets in a loop.

Enabled by this PR:
```rust
let monkey_handle = asset_server.get_handle(&format!("models/monkey/Monkey.gltf#Mesh0/Primitive0"));
let monkey_handle = asset_server.get_handle(format!("models/monkey/Monkey.gltf#Mesh0/Primitive0"));
```

Before this PR:
```rust
let monkey_handle = asset_server.get_handle(format!("models/monkey/Monkey.gltf#Mesh0/Primitive0").as_str());
```

It's just a tiny improvement in ergonomics, but i ran into it and was wondering why the function does not accept a `String` and Bevy is all about simplicity/ergonomics, right? 😄😉

## Solution

Implement `Into<HandleId>` for `String` and `&String`.
2021-12-09 22:40:15 +00:00
..
diagnostic Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
io default features from bevy_asset and bevy_ecs can actually be disabled (#3097) 2021-11-13 21:15:22 +00:00
asset_server.rs Doc AssetServer::load() is async (#3129) 2021-11-13 22:07:19 +00:00
assets.rs iter_mut() for Assets type (#3118) 2021-11-13 04:26:42 +00:00
filesystem_watcher.rs Bump notify to 5.0.0-pre.11 (#2564) 2021-07-29 23:56:16 +00:00
handle.rs Allow String and &String as Id for AssetServer.get_handle(id) (#3280) 2021-12-09 22:40:15 +00:00
info.rs [assets] set LoadState properly and more testing! (#2226) 2021-06-08 02:46:44 +00:00
lib.rs Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
loader.rs Merge New Renderer 2021-11-22 23:57:42 -08:00
path.rs Allow String and &String as Id for AssetServer.get_handle(id) (#3280) 2021-12-09 22:40:15 +00:00