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>
impl<'a> StyledSurface<'_, 'a>
Sourcepub const fn surface(&mut self) -> &mut Surface<'a>
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.
Sourcepub fn put(&mut self, pos: impl Into<Pos<u16>>, ch: char)
pub fn put(&mut self, pos: impl Into<Pos<u16>>, ch: char)
Surface::put using this view’s bound style.
Sourcepub fn print(&mut self, pos: impl Into<Pos<u16>>, text: &str)
pub fn print(&mut self, pos: impl Into<Pos<u16>>, text: &str)
Surface::print using this view’s bound style.
Sourcepub fn fill_rect(&mut self, rect: Rect<u16>, ch: char)
pub fn fill_rect(&mut self, rect: Rect<u16>, ch: char)
Surface::fill_rect using this view’s bound style.
Sourcepub fn put_span<S>(
&mut self,
pos: impl Into<Pos<u16>>,
rows: &[S],
) -> Option<()>
pub fn put_span<S>( &mut self, pos: impl Into<Pos<u16>>, rows: &[S], ) -> Option<()>
Surface::put_span using this view’s bound style.
Sourcepub fn put_span_uniform(
&mut self,
pos: impl Into<Pos<u16>>,
size: impl Into<Size<u16>>,
anchor: char,
fill: char,
) -> Option<()>
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.
Sourcepub fn put_offset(
&mut self,
pos: impl Into<Pos<u16>>,
offset: impl Into<Offset>,
ch: char,
)
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.
Sourcepub fn put_signed(&mut self, pos: (i32, i32), ch: char)
pub fn put_signed(&mut self, pos: (i32, i32), ch: char)
Surface::put_signed using this view’s bound style.
Sourcepub fn blit(&mut self, grid: &Grid, x: u16, y: u16)
pub fn blit(&mut self, grid: &Grid, x: u16, y: u16)
Surface::blit. Takes no style: grid’s own tiles carry their own.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Surface::clear. Takes no style: cleared cells reset to Tile::default.
Sourcepub fn clear_region(&mut self, rect: Rect<u16>)
pub fn clear_region(&mut self, rect: Rect<u16>)
Surface::clear_region. Takes no style: cleared cells reset to
Tile::default.
Sourcepub const fn width(&self) -> u16
pub const fn width(&self) -> u16
Surface::width of the underlying surface.
Sourcepub const fn height(&self) -> u16
pub const fn height(&self) -> u16
Surface::height of the underlying surface.
Sourcepub const fn area(&self) -> Rect<u16>
pub const fn area(&self) -> Rect<u16>
Surface::area of the underlying surface.
Sourcepub const fn clip_rect(&self) -> Rect<u16>
pub const fn clip_rect(&self) -> Rect<u16>
Surface::clip_rect of the underlying surface.
Sourcepub const fn local_area(&self) -> Rect<u16>
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.