Struct ark_api::world::FormattedText
source · [−]pub struct FormattedText { /* private fields */ }Expand description
Represents formatted text that can be attached to a Render component.
Implementations
sourceimpl FormattedText
impl FormattedText
sourcepub fn new(data: &str) -> Self
pub fn new(data: &str) -> Self
Creates the FormattedText from data.
data contains a formatted string, formatted using a custom markup language documented elsewhere. If the string is empty, nothing will be drawn. Only characters supported by Ark’s current hardcoded fonts will work, others may be replaced with little squares or similar. Multiline is OK, \n will be treated as a linebreak (\r is ignored). A native \n character will also be considered a line break.
TODO: Replace this constructor with one that takes a high level representation and encodes the string, similar to the one in ark-modules.
Panics
If there are mistakes in the formatting, it will panic. This is intentional currently since we only intend the markup to be generated from a higher level source, so panics will catch bugs in that conversion but should otherwise never happen.
Trait Implementations
sourceimpl Clone for FormattedText
impl Clone for FormattedText
sourcefn clone(&self) -> FormattedText
fn clone(&self) -> FormattedText
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for FormattedText
impl Debug for FormattedText
sourceimpl Hash for FormattedText
impl Hash for FormattedText
sourceimpl PartialEq<FormattedText> for FormattedText
impl PartialEq<FormattedText> for FormattedText
sourcefn eq(&self, other: &FormattedText) -> bool
fn eq(&self, other: &FormattedText) -> bool
sourceimpl ValueConverterTrait<FormattedText> for ValueConverter
impl ValueConverterTrait<FormattedText> for ValueConverter
sourcefn into_value(v: FormattedText) -> Value
fn into_value(v: FormattedText) -> Value
Value enum.sourcefn from_value(v: &Value) -> FormattedText
fn from_value(v: &Value) -> FormattedText
Value enum.