[][src]Struct cursive::view::Margins

pub struct Margins {
    pub left: usize,
    pub right: usize,
    pub top: usize,
    pub bottom: usize,
}

Four values representing each direction.

Fields

left: usize

Left margin

right: usize

Right margin

top: usize

Top margin

bottom: usize

Bottom margin

Methods

impl Margins[src]

pub fn new(left: usize, right: usize, top: usize, bottom: usize) -> Self[src]

Deprecated:

Margins::new() is ambiguous. Use Margins::lrtb() instead.

Creates a new Margins.

pub fn lrtb(left: usize, right: usize, top: usize, bottom: usize) -> Self[src]

Creates a new Margins object from the Left, Right, Top, Bottom fields.

pub fn ltrb(left_top: Vec2, right_bottom: Vec2) -> Self[src]

Creates a new Margins object from the Left, Top, Right, Bottom fields.

pub fn trbl(top: usize, right: usize, bottom: usize, left: usize) -> Self[src]

Creates a new Margins object from the Top, Right, Bottom, Left fields.

pub fn lr(left: usize, right: usize) -> Self[src]

Creates a new Margins object from the Left and Right fields.

Top and Bottom will be 0.

pub fn tb(top: usize, bottom: usize) -> Self[src]

Creates a new Margins object from the Top and Bottom fields.

Left and Right will be 0.

pub fn horizontal(&self) -> usize[src]

Returns left + right.

pub fn vertical(&self) -> usize[src]

Returns top + bottom.

pub fn combined(&self) -> Vec2[src]

Returns (left+right, top+bottom).

pub fn top_left(&self) -> Vec2[src]

Returns (left, top).

pub fn bot_right(&self) -> Vec2[src]

Returns (right, bottom).

Trait Implementations

impl Add<Margins> for Margins[src]

type Output = Margins

The resulting type after applying the + operator.

impl Clone for Margins[src]

impl Copy for Margins[src]

impl Div<usize> for Margins[src]

type Output = Margins

The resulting type after applying the / operator.

impl Mul<usize> for Margins[src]

type Output = Margins

The resulting type after applying the * operator.

impl Sub<Margins> for Margins[src]

type Output = Margins

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Margins

impl Send for Margins

impl Sync for Margins

impl Unpin for Margins

impl UnwindSafe for Margins

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.