pub trait Alignable: View + Sized {
// Provided methods
fn align_top_left(self) -> AlignedView<Self> { ... }
fn align_top_center(self) -> AlignedView<Self> { ... }
fn align_top_right(self) -> AlignedView<Self> { ... }
fn align_center_left(self) -> AlignedView<Self> { ... }
fn align_center(self) -> AlignedView<Self> { ... }
fn align_center_right(self) -> AlignedView<Self> { ... }
fn align_bottom_left(self) -> AlignedView<Self> { ... }
fn align_bottom_center(self) -> AlignedView<Self> { ... }
fn align_bottom_right(self) -> AlignedView<Self> { ... }
}Expand description
Use this trait to extend all cursive::view::View instances to support
the align_... methods.
This trait provides chainable constructors for the AlignedView.
§Usage Example
use cursive::{Cursive, CursiveExt};
use cursive::view::Resizable;
use cursive::views::{Panel, DummyView};
use cursive_aligned_view::Alignable;
fn main() {
let mut siv = Cursive::default();
let panel = Panel::new(DummyView)
.title("Hello, world!")
.fixed_width(20)
.align_top_center(); // constructing `AlignedView`
siv.add_fullscreen_layer(panel);
// siv.run()
}Provided Methods§
Sourcefn align_top_left(self) -> AlignedView<Self>
fn align_top_left(self) -> AlignedView<Self>
Align a child view at the top-left of the parent.
Sourcefn align_top_center(self) -> AlignedView<Self>
fn align_top_center(self) -> AlignedView<Self>
Align a child view at the top-center of the parent.
Sourcefn align_top_right(self) -> AlignedView<Self>
fn align_top_right(self) -> AlignedView<Self>
Align a child view at the top-right of the parent.
Sourcefn align_center_left(self) -> AlignedView<Self>
fn align_center_left(self) -> AlignedView<Self>
Align a child view at the center-left of the parent.
Sourcefn align_center(self) -> AlignedView<Self>
fn align_center(self) -> AlignedView<Self>
Align a child view at the center of the parent.
Sourcefn align_center_right(self) -> AlignedView<Self>
fn align_center_right(self) -> AlignedView<Self>
Align a child view at the center-right of the parent.
Sourcefn align_bottom_left(self) -> AlignedView<Self>
fn align_bottom_left(self) -> AlignedView<Self>
Align a child view at the bottom-left of the parent.
Sourcefn align_bottom_center(self) -> AlignedView<Self>
fn align_bottom_center(self) -> AlignedView<Self>
Align a child view at the bottom-center of the parent.
Sourcefn align_bottom_right(self) -> AlignedView<Self>
fn align_bottom_right(self) -> AlignedView<Self>
Align a child view at the bottom-right of the parent.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.