[−][src]Struct kas_text::Text
Text, prepared for display in a given enviroment
This struct is composed of three parts: an Environment
, a representation
of the FormattableText
being displayed, and a TextDisplay
object.
Most Functionality is implemented via the TextApi
and TextApiExt
traits.
Implementations
impl<T: FormattableText> Text<T>
[src]
pub fn new(env: Environment, text: T) -> Self
[src]
Construct from an environment and a text model
This struct must be made ready for usage by calling Text::prepare
.
pub fn new_single(text: T) -> Self
[src]
Construct from a default environment (single-line) and text
The environment is default-constructed, with line-wrapping
turned off (see Environment::flags
doc).
pub fn new_multi(text: T) -> Self
[src]
Construct from a default environment (multi-line) and text
The environment is default-constructed (line-wrap on).
pub fn clone_text(&self) -> T where
T: Clone,
[src]
T: Clone,
Clone the formatted text
pub fn take_text(self) -> T
[src]
Extract text object, discarding the rest
pub fn text(&self) -> &T
[src]
Access the formattable text object
pub fn set_text(&mut self, text: T)
[src]
Set the text
One must call Text::prepare
afterwards.
Trait Implementations
impl<T: FormattableText> AsMut<TextDisplay> for Text<T>
[src]
pub fn as_mut(&mut self) -> &mut TextDisplay
[src]
impl<T: FormattableText> AsRef<TextDisplay> for Text<T>
[src]
pub fn as_ref(&self) -> &TextDisplay
[src]
impl<T: Clone + FormattableText> Clone for Text<T>
[src]
impl<T: Debug + FormattableText> Debug for Text<T>
[src]
impl<T: FormattableText + Default> Default for Text<T>
[src]
impl<T: EditableText> EditableTextApi for Text<T>
[src]
pub fn insert_char(&mut self, index: usize, c: char)
[src]
pub fn replace_range(&mut self, range: Range<usize>, replace_with: &str)
[src]
pub fn set_string(&mut self, string: String)
[src]
pub fn swap_string(&mut self, string: &mut String)
[src]
impl<T: FormattableText> TextApi for Text<T>
[src]
pub fn display(&self) -> &TextDisplay
[src]
pub fn as_str(&self) -> &str
[src]
pub fn clone_string(&self) -> String
[src]
pub fn env(&self) -> &Environment
[src]
pub fn env_mut(&mut self) -> &mut Environment
[src]
pub fn require_action(&mut self, action: Action)
[src]
pub fn prepare(&mut self)
[src]
pub fn prepare_runs(&mut self)
[src]
pub fn resize_runs(&mut self)
[src]
pub fn prepare_lines(&mut self) -> Vec2
[src]
pub fn effect_tokens(&self) -> &[Effect<()>]
[src]
pub fn str_len(&self) -> usize
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Text<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Text<T> where
T: Send,
T: Send,
impl<T> Sync for Text<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Text<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Text<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,