bevy/crates/bevy_ui/src
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
..
layout Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
render Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
widget TextLayoutInfo::size should hold the drawn size of the text, and not a scaled value. (#7794) 2023-09-11 18:56:16 +00:00
accessibility.rs Move bevy_ui accessibility systems to PostUpdate. (#8653) 2023-05-23 23:50:48 +00:00
camera_config.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
focus.rs Split ComputedVisibility into two components to allow for accurate change detection and speed up visibility propagation (#9497) 2023-09-01 13:00:18 +00:00
geometry.rs Added Val::ZERO Constant (#9566) 2023-08-26 14:00:53 +00:00
lib.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
measurement.rs Change the default for the measure_func field of ContentSize to None. (#9346) 2023-08-07 23:06:40 +00:00
node_bundles.rs impl From<String> and From<&str> for TextSection (#8856) 2023-09-11 19:00:50 +00:00
stack.rs Fix typos throughout the project (#9090) 2023-07-10 00:11:51 +00:00
ui_node.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
update.rs Do not panic on non-UI child of UI entity (#9621) 2023-08-29 10:49:40 +00:00