mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 16:10:19 +00:00
625d386940
# 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> |
||
---|---|---|
.. | ||
borders.rs | ||
button.rs | ||
display_and_visibility.rs | ||
flex_layout.rs | ||
font_atlas_debug.rs | ||
grid.rs | ||
overflow.rs | ||
overflow_debug.rs | ||
relative_cursor_position.rs | ||
size_constraints.rs | ||
text.rs | ||
text_debug.rs | ||
text_wrap_debug.rs | ||
transparency_ui.rs | ||
ui.rs | ||
ui_scaling.rs | ||
ui_texture_atlas.rs | ||
viewport_debug.rs | ||
window_fallthrough.rs | ||
z_index.rs |