NcPlaneOptionsBuilder

Struct NcPlaneOptionsBuilder 

Source
pub struct NcPlaneOptionsBuilder { /* private fields */ }
Expand description

Builder object for NcPlaneOptions.

Can be constructed by calling NcPlaneOptions::builder().

By default it has the Marginalized flag already set, alongside (0, 0) margins, so that it automatically fills the parent plane.

Implementations§

Source§

impl NcPlaneOptionsBuilder

§Constructors

Source

pub fn new() -> Self

New NcPlaneOptionsBuilder with the Marginalized flag set.

Source

pub fn from_options(options: &NcPlaneOptions) -> Self

New builder from pre-existing options.

Source

pub fn build(self) -> NcPlaneOptions

Finishes the building and returns NcPlaneOptions.

Source§

impl NcPlaneOptionsBuilder

§Methods (chainable)

Source

pub fn y(self, y: i32) -> Self

Sets the vertical placement relative to parent plane.

Default: 0.

Effect: Sets the y coordinate and unsets the VerAligned flag.

Source

pub fn x(self, x: i32) -> Self

Sets the horizontal placement relative to parent plane.

Default: 0.

Effect: Sets the x coordinate and unsets the HorAligned flag.

Source

pub fn yx(self, y: i32, x: i32) -> Self

Sets the vertical & horizontal placement relative to parent plane.

Effect: Sets the x & y coordinates and unsets the VERALIGNED and HORALIGNED flags.

Default: (0, 0).

Source

pub fn valign(self, v: impl Into<NcAlign>) -> Self

Sets the vertical alignment.

Default: NcAlign::Top.

Effect: Sets the v alignment and the VerAligned flag.

Source

pub fn halign(self, h: impl Into<NcAlign>) -> Self

Sets the horizontal alignment.

Default: NcAlign::Left.

Effect: Sets the h alignment and the HorAligned flag.

Source

pub fn align(self, v: impl Into<NcAlign>, h: impl Into<NcAlign>) -> Self

Sets the vertical & horizontal alignment.

Default: (NcAlign::Top, NcAlign::Left).

Effect: Sets the v & h alignments and the VerAligned & HorAligned flags.

Source

pub fn rows(self, rows: u32) -> Self

Sets the number of rows for the plane.

Must be >0 when not using margins.

Default: 0.

Effect: sets the rows field and unsets the Marginalized flag.

Source

pub fn cols(self, cols: u32) -> Self

Sets the number of columns for the plane.

Must be >0 when not using margins.

Default: 0.

Effect: sets the cols field and unsets the Marginalized flag.

Source

pub fn rows_cols(self, rows: u32, cols: u32) -> Self

Sets the number of rows & columns for the plane.

Must be >0 when not using margins.

Default: (0, 0).

Effect: sets the rows & cols fields and unsets the Marginalized flag.

Source

pub fn margins(self, bottom: u32, right: u32) -> Self

Sets the bottom & right margins.

Default: (0, 0).

Effect: sets the margin_b & margin_r fields and the Marginalized flag.

Source

pub fn fixed(self, fixed: bool) -> Self

If true, the plane will not scroll with the parent.

Default: false (scrolls with the parent).

Effect: (un)sets the Fixed flag.

Source

pub fn vscroll(self, vscroll: bool) -> Self

If true, the plane will scroll vertically to accommodate output.

Setting this flag is equivalent to immediately calling set_scrolling(true) following NcPlane creation.

Default: false.

Effect: (un)sets the VScroll flag.

See also: AutoGrow.

Source

pub fn autogrow(self, autogrow: bool) -> Self

If true, the plane will grow automatically.

Default: false.

Effect: (un)sets the AutoGrow flag.

Note that just setting AutoGrow makes the NcPlane grow to the right, and setting AutoGrow + VScroll makes the NcPlane grow down.

Source

pub fn resizecb(self, callback: Option<NcResizeCb>) -> Self

(Un)Sets the resize callback.

Default: None.

Source§

impl NcPlaneOptionsBuilder

§Methods (setable)

Source

pub fn set_y(&mut self, y: i32)

Sets the vertical placement relative to parent plane.

Default: 0.

Effect: Sets the y coordinate and unsets the VerAligned flag.

Source

pub fn set_x(&mut self, x: i32)

Sets the horizontal placement relative to parent plane.

Default: 0.

Effect: Sets the x coordinate and unsets the HorAligned flag.

Source

pub fn set_yx(&mut self, y: i32, x: i32)

Sets the vertical & horizontal placement relative to parent plane.

Effect: Sets the x & y coordinates and unsets the VERALIGNED and HORALIGNED flags.

Default: (0, 0).

Source

pub fn set_valign(&mut self, v: impl Into<NcAlign>)

Sets the vertical alignment.

Default: NcAlign::Top.

Effect: Sets the y alignment and the VerAligned flag.

Source

pub fn set_halign(&mut self, h: impl Into<NcAlign>)

Sets the horizontal alignment.

Default: NcAlign::Left.

Effect: Sets the h alignment and the HorAligned flag.

Source

pub fn set_align(&mut self, v: impl Into<NcAlign>, h: impl Into<NcAlign>)

Sets the vertical & horizontal alignment.

Default: (NcAlign::Top, NcAlign::Left).

Effect: Sets the v & h alignments and the VerAligned & HorAligned flags.

Source

pub fn set_rows(&mut self, rows: u32)

Sets the number of rows for the plane.

Must be >0 when not using margins.

Default: 0.

Effect: sets the rows field and unsets the Marginalized flag.

Source

pub fn set_cols(&mut self, cols: u32)

Sets the number of columns for the plane.

Must be >0 when not using margins.

Default: 0.

Effect: sets the cols field and unsets the Marginalized flag.

Source

pub fn set_rows_cols(&mut self, rows: u32, cols: u32)

Sets the number of rows & columns for the plane.

Must be >0 when not using margins.

Default: (0, 0).

Effect: sets the rows & cols fields and unsets the Marginalized flag.

Source

pub fn set_margins(&mut self, bottom: u32, right: u32)

Sets the bottom & right margins.

Default: (0, 0).

Effect: sets the margin_b & margin_r fields and the Marginalized flag.

Source

pub fn set_fixed(&mut self, fixed: bool)

If true, the plane will not scroll with the parent.

Default: false (scrolls with the parent).

Effect: (un)sets the Fixed flag.

Source

pub fn set_vscroll(&mut self, vscroll: bool)

If true, the plane will scroll vertically to accommodate output.

Setting this flag is equivalent to immediately calling set_scrolling(true) following NcPlane creation.

Default: false.

Effect: (un)sets the VScroll flag.

See also: AutoGrow.

Source

pub fn set_autogrow(&mut self, autogrow: bool)

If true, the plane will grow automatically.

Default: false.

Effect: (un)sets the AutoGrow flag.

Note that just setting AutoGrow makes the NcPlane grow to the right, and setting AutoGrow + VScroll makes the NcPlane grow down.

Source

pub fn set_resizecb(&mut self, callback: Option<NcResizeCb>)

(Un)Sets the resize callback.

Default: None.

Trait Implementations§

Source§

impl Clone for NcPlaneOptionsBuilder

Source§

fn clone(&self) -> NcPlaneOptionsBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NcPlaneOptionsBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NcPlaneOptionsBuilder

Source§

fn default() -> Self

New NcPlaneOptionsBuilder with the Marginalized flag set.

Source§

impl From<&NcPlaneOptionsBuilder> for NcPlaneOptions

Source§

fn from(builder: &NcPlaneOptionsBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<&mut NcPlaneOptionsBuilder> for NcPlaneOptions

Source§

fn from(builder: &mut NcPlaneOptionsBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<&mut ncplane_options> for NcPlaneOptionsBuilder

Source§

fn from(options: &mut NcPlaneOptions) -> Self

Converts to this type from the input type.
Source§

impl From<&ncplane_options> for NcPlaneOptionsBuilder

Source§

fn from(options: &NcPlaneOptions) -> Self

Converts to this type from the input type.
Source§

impl From<NcPlaneOptionsBuilder> for NcPlaneOptions

Source§

fn from(builder: NcPlaneOptionsBuilder) -> NcPlaneOptions

Converts to this type from the input type.
Source§

impl From<ncplane_options> for NcPlaneOptionsBuilder

Source§

fn from(options: NcPlaneOptions) -> NcPlaneOptionsBuilder

Converts to this type from the input type.

Auto Trait Implementations§

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.