Skip to main content

MeasureRequests

Struct MeasureRequests 

Source
pub struct MeasureRequests { /* private fields */ }
Expand description

A set of questions for one call, built up and then asked at once.

Reused across frames: clearing keeps every buffer’s capacity, so once warm, asking the same number of questions allocates nothing.

Implementations§

Source§

impl MeasureRequests

Source

pub fn new() -> Self

Source

pub fn set_zoom(&mut self, zoom: f32)

Measures the requests asked from here on at zoom zoom: the zoom of the page region they belong to, which is the operating system’s text size times the application’s own zoom. The Renderer measures them at its density times zoom, with no font scale of its own, and answers in the region’s CSS pixels.

A Host can hold several regions at different zooms, which is why this travels with every request rather than being the Renderer’s state. Never set, it is one.

Source

pub fn clear(&mut self)

Forgets every question, keeping the room they took.

Source

pub fn len(&self) -> usize

How many questions there are.

Source

pub fn is_empty(&self) -> bool

Source

pub fn text( &mut self, text: &str, spans: &TextSpans, style: &TextStyle, constraint: TextConstraint, ) -> usize

Asks how big text, with spans laid over it and set in style, is under constraint. Returns the index its answer will have.

Source

pub fn node(&mut self, node_id: u32, constraints: NodeConstraints) -> usize

Asks how big the node node_id, which the Renderer has already applied, is under constraints. Returns the index its answer will have.

Source

pub fn encoded(&mut self) -> &[u8] ⓘ

The buffer these requests are sent as: the records, then the payload, every offset counted from its start.

Trait Implementations§

Source§

impl Debug for MeasureRequests

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MeasureRequests

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.