pub struct RwArea(/* private fields */);Expand description
A type erased RawArea
This type houses the inner Area, and provides type erased access
to its functions.
Implementations§
Source§impl RwArea
impl RwArea
Sourcepub fn write_as<'a, A: RawArea>(&'a self, pa: &'a mut Pass) -> Option<&'a mut A>
pub fn write_as<'a, A: RawArea>(&'a self, pa: &'a mut Pass) -> Option<&'a mut A>
Attempt to write this as a specific implementation of
RawArea
You can use this to deal with individual RawAreas, so you
can do a “per Ui” configuration for your
Plugin/configuration. This could be used to, for example,
place frames around an Area when making use of a terminal
Ui, or using some custom css when using a web Ui.
This will return None if the RawArea within is of a
different type.
Sourcepub fn set_width(&self, pa: &mut Pass, width: f32) -> Result<(), Text>
pub fn set_width(&self, pa: &mut Pass, width: f32) -> Result<(), Text>
Sets the width of the RawArea
Sourcepub fn set_height(&self, pa: &mut Pass, height: f32) -> Result<(), Text>
pub fn set_height(&self, pa: &mut Pass, height: f32) -> Result<(), Text>
Sets the height of the RawArea
Sourcepub fn set_as_active(&self, pa: &mut Pass)
pub fn set_as_active(&self, pa: &mut Pass)
Sourcepub fn width_of_text(
&self,
pa: &Pass,
opts: PrintOpts,
text: &Text,
) -> Result<f32, Text>
pub fn width_of_text( &self, pa: &Pass, opts: PrintOpts, text: &Text, ) -> Result<f32, Text>
What width the given Text would occupy, if unwrapped
Sourcepub fn print_with<'a>(
&self,
pa: &Pass,
text: &Text,
opts: PrintOpts,
painter: Painter,
f: impl FnMut(&Caret, &Item) + 'a,
)
pub fn print_with<'a>( &self, pa: &Pass, text: &Text, opts: PrintOpts, painter: Painter, f: impl FnMut(&Caret, &Item) + 'a, )
Prints the Text with a callback function
Sourcepub fn get_print_info(&self, pa: &Pass) -> PrintInfo
pub fn get_print_info(&self, pa: &Pass) -> PrintInfo
The current printing information of the area
Sourcepub fn set_print_info(&self, pa: &mut Pass, info: PrintInfo)
pub fn set_print_info(&self, pa: &mut Pass, info: PrintInfo)
Sets a previously acquired PrintInfo to the area
Sourcepub fn print_iter<'a>(
&self,
pa: &Pass,
text: &'a Text,
points: TwoPoints,
opts: PrintOpts,
) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
pub fn print_iter<'a>( &self, pa: &Pass, text: &'a Text, points: TwoPoints, opts: PrintOpts, ) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
Returns a printing iterator
Given an iterator of text::Items, returns an iterator
which assigns to each of them a Caret. This struct
essentially represents where horizontally would this character
be printed.
If you want a reverse iterator, see
Area::rev_print_iter.
Sourcepub fn rev_print_iter<'a>(
&self,
pa: &Pass,
text: &'a Text,
points: TwoPoints,
opts: PrintOpts,
) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
pub fn rev_print_iter<'a>( &self, pa: &Pass, text: &'a Text, points: TwoPoints, opts: PrintOpts, ) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
Returns a reversed printing iterator
Given an iterator of text::Items, returns a reversed
iterator which assigns to each of them a Caret. This
struct essentially represents where horizontally each
character would be printed.
If you want a forwards iterator, see Area::print_iter.
Sourcepub fn scroll_around_points(
&self,
pa: &mut Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_around_points( &self, pa: &mut Pass, text: &Text, points: TwoPoints, opts: PrintOpts, )
Scrolls the Text on all four directions until the given
TwoPoints is within the ScrollOff range
There are two other scrolling methods for Area:
scroll_ver and scroll_to_points. The difference
between this and scroll_to_points is that this method
doesn’t do anything if the TwoPoints is already on screen.
Sourcepub fn scroll_to_points(
&self,
pa: &mut Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_to_points( &self, pa: &mut Pass, text: &Text, points: TwoPoints, opts: PrintOpts, )
Scrolls the Text to the visual line of a TwoPoints
This method takes line wrapping into account, so it’s not
the same as setting the starting points to the
Text::visual_line_start of these TwoPoints.
If scroll_beyond is set, then the Text will be allowed
to scroll beyond the last line, up until reaching the
scrolloff.y value.
Sourcepub fn has_changed(&self, pa: &Pass) -> bool
pub fn has_changed(&self, pa: &Pass) -> bool
Wether this Area has changed since last being printed
Sourcepub fn is_master_of(&self, pa: &Pass, other: &Self) -> bool
pub fn is_master_of(&self, pa: &Pass, other: &Self) -> bool
Whether or not this Area is the “master” of another
Sourcepub fn store_cache(&self, pa: &Pass, path: &str) -> Result<(), Text>
pub fn store_cache(&self, pa: &Pass, path: &str) -> Result<(), Text>
Stores the cache of the Area, given a path to associate
with this cache
Sourcepub fn bottom_right(&self, pa: &Pass) -> Coord
pub fn bottom_right(&self, pa: &Pass) -> Coord
The bottom right Coord of this Area
Sourcepub fn coord_at_points(
&self,
pa: &Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
) -> Option<Coord>
pub fn coord_at_points( &self, pa: &Pass, text: &Text, points: TwoPoints, opts: PrintOpts, ) -> Option<Coord>
Sourcepub fn points_at_coord(
&self,
pa: &Pass,
text: &Text,
coord: Coord,
opts: PrintOpts,
) -> Option<TwoPointsPlace>
pub fn points_at_coord( &self, pa: &Pass, text: &Text, coord: Coord, opts: PrintOpts, ) -> Option<TwoPointsPlace>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RwArea
impl !RefUnwindSafe for RwArea
impl Send for RwArea
impl Sync for RwArea
impl Unpin for RwArea
impl !UnwindSafe for RwArea
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.