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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl 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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl ValueConverterTrait<FormattedText> for ValueConverter
impl ValueConverterTrait<FormattedText> for ValueConverter
sourcefn into_value(v: FormattedText) -> Value
fn into_value(v: FormattedText) -> Value
Wraps the passed-in value in a Value
enum.
sourcefn from_value(v: &Value) -> FormattedText
fn from_value(v: &Value) -> FormattedText
Extracts the value from a Value
enum.
impl Eq for FormattedText
impl StructuralEq for FormattedText
impl StructuralPartialEq for FormattedText
Auto Trait Implementations
impl RefUnwindSafe for FormattedText
impl Send for FormattedText
impl Sync for FormattedText
impl Unpin for FormattedText
impl UnwindSafe for FormattedText
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more