Skip to main content

StyledSurface

Struct StyledSurface 

Source
pub struct StyledSurface<'s, 'a> { /* private fields */ }
Expand description

A Surface with a Style bound in, returned by Surface::with_style.

Every draw call omits the style argument the underlying Surface method would otherwise need, using the bound style instead. Reach back to the underlying surface (e.g. to call Surface::print_line, whose per-span styles make a bound style meaningless) via StyledSurface::surface.

Implementations§

Source§

impl<'a> StyledSurface<'_, 'a>

Source

pub const fn style(&self) -> Style

The style every draw call on this view uses.

Source

pub const fn surface(&mut self) -> &mut Surface<'a>

Borrows the underlying Surface directly, for calls that need an explicit style (e.g. Surface::print_line) or a capability StyledSurface doesn’t expose.

Source

pub fn put(&mut self, pos: impl Into<Pos<u16>>, ch: char)

Surface::put using this view’s bound style.

Source

pub fn print(&mut self, pos: impl Into<Pos<u16>>, text: &str)

Surface::print using this view’s bound style.

Source

pub fn fill_rect(&mut self, rect: Rect<u16>, ch: char)

Surface::fill_rect using this view’s bound style.

Source

pub fn put_span<S>( &mut self, pos: impl Into<Pos<u16>>, rows: &[S], ) -> Option<()>
where S: AsRef<str>,

Surface::put_span using this view’s bound style.

Source

pub fn put_span_uniform( &mut self, pos: impl Into<Pos<u16>>, size: impl Into<Size>, anchor: char, fill: char, ) -> Option<()>

Surface::put_span_uniform using this view’s bound style.

Source

pub fn put_offset( &mut self, pos: impl Into<Pos<u16>>, offset: impl Into<Offset>, ch: char, )

Surface::put_offset using this view’s bound style.

Auto Trait Implementations§

§

impl<'s, 'a> !UnwindSafe for StyledSurface<'s, 'a>

§

impl<'s, 'a> Freeze for StyledSurface<'s, 'a>

§

impl<'s, 'a> RefUnwindSafe for StyledSurface<'s, 'a>

§

impl<'s, 'a> Send for StyledSurface<'s, 'a>

§

impl<'s, 'a> Sync for StyledSurface<'s, 'a>

§

impl<'s, 'a> Unpin for StyledSurface<'s, 'a>

§

impl<'s, 'a> UnsafeUnpin for StyledSurface<'s, 'a>

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 = 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.