Measure

Struct Measure 

Source
pub struct Measure;
Expand description

This struct implements the Surface trait and can be used to measure the width of text without drawing anything

Trait Implementations§

Source§

impl Surface for Measure

Source§

fn clear(&mut self)

Clear all pixels
Source§

fn pixel(&mut self, _x: i32, _y: i32)

Fill a pixel
Source§

fn height(&self) -> i32

Get the height of the surface
Source§

fn width(&self) -> i32

Get the width of the surface
Source§

fn line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)

Draw a line

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<S> Awakening for S
where S: Surface,

Source§

fn awakening(&mut self, x: i32, y: i32, text: &str) -> i32

Write the text with the baseline starting at the given position. Returns the width of the text in pixels.
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<S> DigitsLarge for S
where S: Surface,

Source§

fn digits_large(&mut self, x: i32, y: i32, text: &str) -> i32

Write the text with the baseline starting at the given position. Returns the width of the text in pixels.
Source§

impl<S> DigitsMedium for S
where S: Surface,

Source§

fn digits_medium(&mut self, x: i32, y: i32, text: &str) -> i32

Write the text with the baseline starting at the given position. Returns the width of the text in pixels.
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<S> Premium for S
where S: Surface,

Source§

fn premium(&mut self, x: i32, y: i32, text: &str) -> i32

Write the text with the baseline starting at the given position. Returns the width of the text in pixels.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.