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<u16>>, 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.

Source

pub fn put_signed(&mut self, pos: (i32, i32), ch: char)

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

Source

pub fn blit(&mut self, grid: &Grid, x: u16, y: u16)

Surface::blit. Takes no style: grid’s own tiles carry their own.

Source

pub fn clear(&mut self)

Surface::clear. Takes no style: cleared cells reset to Tile::default.

Source

pub fn clear_region(&mut self, rect: Rect<u16>)

Surface::clear_region. Takes no style: cleared cells reset to Tile::default.

Source

pub const fn width(&self) -> u16

Surface::width of the underlying surface.

Source

pub const fn height(&self) -> u16

Surface::height of the underlying surface.

Source

pub const fn area(&self) -> Rect<u16>

Surface::area of the underlying surface.

Source

pub const fn clip_rect(&self) -> Rect<u16>

Surface::clip_rect of the underlying surface.

Source

pub const fn local_area(&self) -> Rect<u16>

Surface::area of the underlying surface, translated to its own local coordinate space (self.area().at_origin()).

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more