bevy/examples/ui
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
..
borders.rs Ui Node Borders (#7795) 2023-06-14 22:43:38 +00:00
button.rs Rename Interaction::Clicked -> Interaction::Pressed (#8989) (#9027) 2023-07-05 09:25:31 +00:00
display_and_visibility.rs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
flex_layout.rs UI examples clean up (#9479) 2023-08-23 12:49:10 +00:00
font_atlas_debug.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
grid.rs UI examples clean up (#9479) 2023-08-23 12:49:10 +00:00
overflow.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
overflow_debug.rs Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
relative_cursor_position.rs UI examples clean up (#9479) 2023-08-23 12:49:10 +00:00
size_constraints.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
text.rs impl From<String> and From<&str> for TextSection (#8856) 2023-09-11 19:00:50 +00:00
text_debug.rs Allow tuples and single plugins in add_plugins, deprecate add_plugin (#8097) 2023-06-21 20:51:03 +00:00
text_wrap_debug.rs NoWrap Text feature (#8947) 2023-06-26 16:23:00 +00:00
transparency_ui.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
ui.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
ui_scaling.rs Change UiScale to a tuple struct (#9444) 2023-08-16 18:18:50 +00:00
ui_texture_atlas.rs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
viewport_debug.rs Use default resolution for viewport_debug example (#9666) 2023-09-02 18:43:56 +00:00
window_fallthrough.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
z_index.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00