Trait embedded_layout::View
source · pub trait View {
// Required methods
fn translate_impl(&mut self, by: Point);
fn bounds(&self) -> Rectangle;
// Provided methods
fn size(&self) -> Size { ... }
fn translate_mut(&mut self, by: Point) -> &mut Self
where Self: Sized { ... }
fn translate(self, by: Point) -> Self
where Self: Sized { ... }
}
Expand description
A View
is the base unit for most of the embedded-layout
operations.
View
s must have a size and a position.
See the custom_view
example for how you can define more complex views.
Required Methods§
sourcefn translate_impl(&mut self, by: Point)
fn translate_impl(&mut self, by: Point)
Object-safe version of translate_mut()
.
The default implementations of translate
and translate_mut
both call this functions.
Provided Methods§
sourcefn translate_mut(&mut self, by: Point) -> &mut Selfwhere
Self: Sized,
fn translate_mut(&mut self, by: Point) -> &mut Selfwhere Self: Sized,
Move the origin of an object by a given number of (x, y) pixels, mutating the object in place.
If you a looking for a method to implement, you might want translate_impl()
instead.