bevy/crates
ickshonpe 625d386940
impl From<String> and From<&str> for TextSection (#8856)
# Objective

Implement `From<String>` and `From<&str>` for `TextSection`

Example from something I was working on earlier:
```rust
parent.spawn(TextBundle::from_sections([
    TextSection::new("press ".to_string(), TextStyle::default()),
    TextSection::new("space".to_string(), TextStyle { color: Color::YELLOW, ..default() }),
    TextSection::new(" to advance frames".to_string(), TextStyle::default()),
]));
```

After an `impl From<&str> for TextSection` :

```rust
parent.spawn(TextBundle::from_sections([
    "press ".into(),
    TextSection::new("space".to_string(), TextStyle { color: Color::YELLOW, ..default() }),
    " to advance frames".into(),
]));
```

* Potentially unhelpful without a default font, so behind the
`default_font` feature.

 Co-authored-by: [hate](https://github.com/hate)

---------

Co-authored-by: hate <15314665+hate@users.noreply.github.com>
2023-09-11 19:00:50 +00:00
..
bevy_a11y Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_animation Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_app Replace IntoSystemSetConfig with IntoSystemSetConfigs (#9247) 2023-09-05 17:15:27 +00:00
bevy_asset Increase iteration count for asset tests (#9737) 2023-09-10 21:37:33 +00:00
bevy_audio Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core_pipeline Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_derive bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_diagnostic Add DiagnosticsStore::iter_mut (#9679) 2023-09-03 13:26:13 +00:00
bevy_dylib Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_dynamic_plugin Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_ecs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_ecs_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_encase_derive Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_gilrs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
bevy_gizmos Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_gltf Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_hierarchy Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_input Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
bevy_internal Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_log Update tracy-client requirement from 0.15 to 0.16 (#9436) 2023-08-15 07:45:21 +00:00
bevy_macro_utils Add some more helpful errors to BevyManifest when it doesn't find Cargo.toml (#9207) 2023-07-19 12:05:04 +00:00
bevy_macros_compile_fail_tests bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_math Fix erronenous glam version (#9653) 2023-08-31 12:55:17 +00:00
bevy_mikktspace Fix erronenous glam version (#9653) 2023-08-31 12:55:17 +00:00
bevy_pbr Fix some warnings (#9724) 2023-09-08 21:49:03 +00:00
bevy_ptr Put #[repr(transparent)] attr to bevy_ptr types (#9068) 2023-07-14 18:55:15 +00:00
bevy_reflect Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_reflect_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_render Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_scene Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_sprite TextureAtlasBuilder padding (#9494) 2023-09-08 15:02:48 +00:00
bevy_tasks elaborate on TaskPool and bevy tasks (#8750) 2023-08-11 21:07:28 +00:00
bevy_text impl From<String> and From<&str> for TextSection (#8856) 2023-09-11 19:00:50 +00:00
bevy_time Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_transform Replace IntoSystemSetConfig with IntoSystemSetConfigs (#9247) 2023-09-05 17:15:27 +00:00
bevy_ui impl From<String> and From<&str> for TextSection (#8856) 2023-09-11 19:00:50 +00:00
bevy_utils Copy on Write AssetPaths (#9729) 2023-09-09 23:15:10 +00:00
bevy_window Refer to "macOS", not "macOS X". (#9704) 2023-09-05 19:06:08 +00:00
bevy_winit Fix some nightly warnings (#9672) 2023-09-02 18:35:06 +00:00