pub struct ResolvedView { /* private fields */ }Expand description
A view resolved to one rectangle of styled graphemes.
Every row’s widths sum to size.width(), and the row count equals
size.height(). Styles are logical: a
RenderSettings is applied when a renderer
serializes the rectangle, so capability resolution stays at the output
boundary.
Implementations§
Source§impl ResolvedView
impl ResolvedView
pub const fn size(&self) -> Size
pub fn rows(&self) -> &[Vec<StyledGrapheme>]
Sourcepub fn anchors(&self) -> &[AnchoredRect]
pub fn anchors(&self) -> &[AnchoredRect]
Where each anchor in the tree landed, in tree order — a box before what it encloses.
A tree carrying no anchor reports nothing, which is every view built before anchors existed.
Sourcepub fn anchor(&self, key: impl Into<Key>) -> Option<&AnchoredRect>
pub fn anchor(&self, key: impl Into<Key>) -> Option<&AnchoredRect>
The region reported under key.
This is the ordinary read: a caller filling one region asks for it by
name rather than scanning anchors.
use urushi::{Available, BlockStyle, TextStyle, VerticalAlign, View, resolve};
let view = View::row(
VerticalAlign::Top,
[View::text("> ", TextStyle::new()), View::anchor("cursor")],
);
let resolved = resolve(&view, Available::NONE).unwrap();
assert_eq!(resolved.anchor("cursor").unwrap().x(), 2);
assert!(resolved.anchor("elsewhere").is_none());Trait Implementations§
Source§impl Clone for ResolvedView
impl Clone for ResolvedView
Source§fn clone(&self) -> ResolvedView
fn clone(&self) -> ResolvedView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ResolvedView
impl Debug for ResolvedView
Source§impl PartialEq for ResolvedView
impl PartialEq for ResolvedView
Source§fn eq(&self, other: &ResolvedView) -> bool
fn eq(&self, other: &ResolvedView) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ResolvedView
impl StructuralPartialEq for ResolvedView
Auto Trait Implementations§
impl Freeze for ResolvedView
impl RefUnwindSafe for ResolvedView
impl Send for ResolvedView
impl Sync for ResolvedView
impl Unpin for ResolvedView
impl UnsafeUnpin for ResolvedView
impl UnwindSafe for ResolvedView
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