Struct Char2DArray

Source
pub struct Char2DArray {
    pub buffer: Vec<Vec<char>>,
    /* private fields */
}
Expand description

2-d array of chars

Fields§

§buffer: Vec<Vec<char>>

2-d array of chars by Vec

Implementations§

Source§

impl Char2DArray

Source

pub fn new(width: usize, height: usize) -> Char2DArray

create Char2DArray create Char2DArray and initialize value by ’ ’

Source

pub fn debug_print(&self)

Source

pub fn from(src: Vec<Vec<char>>) -> Char2DArray

create Char2DArray from Vec<Vec>

Source

pub fn to_lines(&self) -> Vec<String>

conver to Vec

Source

pub fn save(&self, save_file: &str) -> Result<()>

save to file

Source

pub fn height(&self) -> usize

get number of lines

Source

pub fn width(&self) -> usize

get number of rows

Source

pub fn overwrite_rect( &mut self, rect: &Char2DArray, position: CharPosition, transparent: Option<char>, )

overwrite data by another Char2DArray

Source

pub fn overwrite_rect_center( &mut self, rect: &Char2DArray, position: CharPosition, transparent: Option<char>, )

Source

pub fn overwrite_line(&mut self, ch: char, line_index: usize)

Source

pub fn overwrite_char(&mut self, ch: char, position: CharPosition)

Source

pub fn overwrite_char_all(&mut self, ch: char)

Source

pub fn copy_from(&mut self, src: &Char2DArray)

Source

pub fn overwrite_fn<F: Fn(usize, usize, char) -> bool>( &mut self, ch: char, f: F, )

Source

pub fn overwrite_random_fn<F: Fn(usize, usize, char) -> bool>( &mut self, chars: Vec<char>, f: F, )

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> 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> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V