pub struct Text {
pub sections: Vec<TextSection>,
pub alignment: TextAlignment,
}
Fields§
§sections: Vec<TextSection>
§alignment: TextAlignment
Implementations§
Source§impl Text
impl Text
Sourcepub fn with_section<S>(
value: S,
style: TextStyle,
alignment: TextAlignment,
) -> Text
pub fn with_section<S>( value: S, style: TextStyle, alignment: TextAlignment, ) -> Text
Constructs a Text
with (initially) one section.
// basic usage
let hello_world = Text::with_section(
"hello world!".to_string(),
TextStyle {
font: font_handle.clone(),
font_size: 60.0,
color: Color::WHITE,
},
TextAlignment {
vertical: VerticalAlign::Center,
horizontal: HorizontalAlign::Center,
},
);
let hello_bevy = Text::with_section(
// accepts a String or any type that converts into a String, such as &str
"hello bevy!",
TextStyle {
font: font_handle,
font_size: 60.0,
color: Color::WHITE,
},
// you can still use Default
Default::default(),
);
Trait Implementations§
Source§impl GetTypeRegistration for Text
impl GetTypeRegistration for Text
Source§impl Reflect for Text
impl Reflect for Text
fn type_name(&self) -> &str
fn any(&self) -> &(dyn Any + 'static)
fn any_mut(&mut self) -> &mut (dyn Any + 'static)
fn clone_value(&self) -> Box<dyn Reflect>
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
fn apply(&mut self, value: &(dyn Reflect + 'static))
fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Returns a serializable value, if serialization is supported. Otherwise
None
will be
returned.Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type) if hashing is supported. Otherwise
None
will be returned.Source§impl Struct for Text
impl Struct for Text
fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>
fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn name_at(&self, index: usize) -> Option<&str>
fn field_len(&self) -> usize
fn iter_fields(&self) -> FieldIter<'_>
fn clone_dynamic(&self) -> DynamicStruct
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given World