pub struct ActionText {
pub text: VecDeque<ActionSubText>,
pub ch_key: Option<String>,
pub character: Option<String>,
pub vars: VarMap,
}Expand description
The text is a VecDeque<ActionSubText>.
The ActionSubText could be pushed and poped at front or back.
Generally, you should avoid using push_back directly.
To reduce allocations in serialization, you should use
push_back_chars and push_back_block.
let mut text = ActionText::default();
text.push_back_chars("Hello ");
assert_eq!(text.text[0], ActionSubText::chars("Hello "));
text.push_back_chars("world!");
assert_eq!(text.text[0], ActionSubText::chars("Hello world!"));Fields§
§text: VecDeque<ActionSubText>The full texts.
ch_key: Option<String>The key of current character.
character: Option<String>The current character.
vars: VarMapThe temp variables.
Implementations§
Source§impl ActionText
impl ActionText
Sourcepub fn push_back_chars<'a>(&mut self, s: impl Into<Cow<'a, str>>)
pub fn push_back_chars<'a>(&mut self, s: impl Into<Cow<'a, str>>)
Push the string as ActionSubText::Chars to the back.
If the back element is also ActionSubText::Chars, the string is appended.
Sourcepub fn push_back_block<'a>(&mut self, s: impl Into<Cow<'a, str>>)
pub fn push_back_block<'a>(&mut self, s: impl Into<Cow<'a, str>>)
Push the string as ActionSubText::Block to the back.
If the back element is also ActionSubText::Block, the string is appended.
Trait Implementations§
Source§impl Clone for ActionText
impl Clone for ActionText
Source§fn clone(&self) -> ActionText
fn clone(&self) -> ActionText
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActionText
impl Debug for ActionText
Source§impl Default for ActionText
impl Default for ActionText
Source§fn default() -> ActionText
fn default() -> ActionText
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ActionText
impl<'de> Deserialize<'de> for ActionText
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ActionText
impl Display for ActionText
Source§impl FallbackSpec for ActionText
impl FallbackSpec for ActionText
Source§impl PartialEq for ActionText
impl PartialEq for ActionText
Auto Trait Implementations§
impl Freeze for ActionText
impl RefUnwindSafe for ActionText
impl Send for ActionText
impl Sync for ActionText
impl Unpin for ActionText
impl UnwindSafe for ActionText
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