[−][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> Text<T> where
T: FormattableText,
[src]
T: FormattableText,
pub fn new(env: Environment, text: T) -> Text<T>
[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) -> Text<T>
[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) -> Text<T>
[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> AsMut<TextDisplay> for Text<T> where
T: FormattableText,
[src]
T: FormattableText,
pub fn as_mut(&mut self) -> &mut TextDisplay
[src]
impl<T> AsRef<TextDisplay> for Text<T> where
T: FormattableText,
[src]
T: FormattableText,
pub fn as_ref(&self) -> &TextDisplay
[src]
impl<T> Clone for Text<T> where
T: FormattableText + Clone,
[src]
T: FormattableText + Clone,
impl<T> Debug for Text<T> where
T: FormattableText + Debug,
[src]
T: FormattableText + Debug,
impl<T> Default for Text<T> where
T: FormattableText + Default,
[src]
T: FormattableText + Default,
impl<T> EditableTextApi for Text<T> where
T: EditableText,
[src]
T: EditableText,
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> TextApi for Text<T> where
T: FormattableText,
[src]
T: FormattableText,
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> TextApiExt for T where
T: TextApi + ?Sized,
[src]
T: TextApi + ?Sized,
pub fn update_env<F>(&mut self, f: F) -> Vec2 where
F: FnOnce(&mut UpdateEnv<'_>),
[src]
F: FnOnce(&mut UpdateEnv<'_>),
pub fn required_action(&self) -> Action
[src]
pub fn num_lines(&self) -> usize
[src]
pub fn find_line(&self, index: usize) -> Option<(usize, Range<usize>)>
[src]
pub fn line_range(&self, line: usize) -> Option<Range<usize>>
[src]
pub fn line_is_ltr(&self, line: usize) -> bool
[src]
pub fn line_is_rtl(&self, line: usize) -> bool
[src]
pub fn text_index_nearest(&self, pos: Vec2) -> usize
[src]
pub fn line_index_nearest(&self, line: usize, x: f32) -> Option<usize>
[src]
pub fn text_glyph_pos(&self, index: usize) -> MarkerPosIterⓘNotable traits for MarkerPosIter
impl Iterator for MarkerPosIter type Item = MarkerPos;
[src]
Notable traits for MarkerPosIter
impl Iterator for MarkerPosIter type Item = MarkerPos;
pub fn num_glyphs(&self) -> usize
[src]
pub fn glyphs<F>(&self, f: F) where
F: FnMut(FontId, f32, f32, Glyph),
[src]
F: FnMut(FontId, f32, f32, Glyph),
pub fn glyphs_with_effects<X, F, G>(&self, effects: &[Effect<X>], f: F, g: G) where
F: FnMut(FontId, f32, f32, Glyph, usize, X),
G: FnMut(f32, f32, f32, f32, usize, X),
X: Copy + Default,
[src]
F: FnMut(FontId, f32, f32, Glyph, usize, X),
G: FnMut(f32, f32, f32, f32, usize, X),
X: Copy + Default,
pub fn highlight_lines(&self, range: Range<usize>) -> Vec<(Vec2, Vec2), Global>
[src]
pub fn highlight_runs(&self, range: Range<usize>) -> Vec<(Vec2, Vec2), Global>
[src]
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>,