pub struct Area { /* private fields */ }Expand description
A type erased RawUi::Area
This struct is accessed by calling RwArea::read or
RwData::write.
Implementations§
Source§impl Area
impl Area
Sourcepub fn set_as_active(&mut self)
pub fn set_as_active(&mut self)
Sourcepub fn width_of_text(&self, opts: PrintOpts, text: &Text) -> Result<f32, Text>
pub fn width_of_text(&self, opts: PrintOpts, text: &Text) -> Result<f32, Text>
What width the given Text would occupy, if unwrapped
Sourcepub fn print_with<'a>(
&self,
text: &Text,
opts: PrintOpts,
painter: Painter,
f: impl FnMut(&Caret, &Item) + 'a,
)
pub fn print_with<'a>( &self, 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) -> PrintInfo
pub fn get_print_info(&self) -> PrintInfo
The current printing information of the area
Sourcepub fn set_print_info(&mut self, info: PrintInfo)
pub fn set_print_info(&mut self, info: PrintInfo)
Sets a previously acquired PrintInfo to the area
Sourcepub fn print_iter<'a>(
&self,
text: &'a Text,
points: TwoPoints,
opts: PrintOpts,
) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
pub fn print_iter<'a>( &self, 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,
text: &'a Text,
points: TwoPoints,
opts: PrintOpts,
) -> Box<dyn Iterator<Item = (Caret, Item)> + 'a>
pub fn rev_print_iter<'a>( &self, 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_ver(&mut self, text: &Text, dist: i32, opts: PrintOpts)
pub fn scroll_ver(&mut self, text: &Text, dist: i32, opts: PrintOpts)
Sourcepub fn scroll_around_points(
&mut self,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_around_points( &mut self, 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(
&mut self,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_to_points( &mut self, 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 start_points(&self, text: &Text, opts: PrintOpts) -> TwoPoints
pub fn start_points(&self, text: &Text, opts: PrintOpts) -> TwoPoints
Scrolls the Area to the given TwoPoints
Sourcepub fn end_points(&self, text: &Text, opts: PrintOpts) -> TwoPoints
pub fn end_points(&self, text: &Text, opts: PrintOpts) -> TwoPoints
Scrolls the Area to the given TwoPoints
Sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Wether this Area has changed since last being printed
Sourcepub fn is_master_of(&self, other: &Self) -> bool
pub fn is_master_of(&self, other: &Self) -> bool
Whether or not this Area is the “master” of another
Sourcepub fn store_cache(&mut self, path: &str) -> Result<(), Text>
pub fn store_cache(&mut self, path: &str) -> Result<(), Text>
Stores the cache of the Area, given a path to associate
with this cache
Sourcepub fn bottom_right(&self) -> Coord
pub fn bottom_right(&self) -> Coord
The bottom right Coord of this Area
Sourcepub fn coord_at_points(
&self,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
) -> Option<Coord>
pub fn coord_at_points( &self, text: &Text, points: TwoPoints, opts: PrintOpts, ) -> Option<Coord>
Sourcepub fn points_at_coord(
&self,
text: &Text,
coord: Coord,
opts: PrintOpts,
) -> Option<TwoPointsPlace>
pub fn points_at_coord( &self, text: &Text, coord: Coord, opts: PrintOpts, ) -> Option<TwoPointsPlace>
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if this is the currently active Area
Only one Area should be active at any given moment.
Sourcepub fn area_is_eq(&self, other: &Area) -> bool
pub fn area_is_eq(&self, other: &Area) -> bool
Wether this Area is the same as another
Auto Trait Implementations§
impl Freeze for Area
impl !RefUnwindSafe for Area
impl !Send for Area
impl !Sync for Area
impl Unpin for Area
impl !UnwindSafe for Area
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> 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.