[−][src]Struct meli::terminal::cells::CellBuffer
An array of Cell
s that represents a terminal display.
A CellBuffer
is a two-dimensional array of Cell
s, each pair of indices correspond to a
single point on the underlying terminal.
The first index, Cellbuffer[y]
, corresponds to a row, and thus the y-axis. The second
index, Cellbuffer[y][x]
, corresponds to a column within a row and thus the x-axis.
Fields
cols: usize
rows: usize
buf: Vec<Cell>
default_cell: Cell
ascii_drawing: bool
ASCII-only flag.
growable: bool
If printing to this buffer and we run out of space, expand it.
tag_table: HashMap<u64, FormatTag>
tag_associations: SmallVec<[(u64, (usize, usize)); 128]>
Implementations
impl CellBuffer
[src]
pub fn area(&self) -> Area
[src]
pub fn set_cols(&mut self, new_cols: usize)
[src]
pub fn new(cols: usize, rows: usize, default_cell: Cell) -> CellBuffer
[src]
Constructs a new CellBuffer
with the given number of columns and rows, using the given
cell
as a blank.
pub fn new_with_context(
cols: usize,
rows: usize,
default_cell: Option<Cell>,
context: &Context
) -> CellBuffer
[src]
cols: usize,
rows: usize,
default_cell: Option<Cell>,
context: &Context
) -> CellBuffer
pub fn set_ascii_drawing(&mut self, new_val: bool)
[src]
pub fn set_growable(&mut self, new_val: bool)
[src]
pub fn resize(&mut self, newcols: usize, newrows: usize, blank: Cell)
[src]
Resizes CellBuffer
to the given number of rows and columns, using the given Cell
as
a blank.
pub fn is_empty(&self) -> bool
[src]
pub fn empty(&mut self)
[src]
pub fn clear(&mut self, blank: Cell)
[src]
Clears self
, using the given Cell
as a blank.
pub fn pos_to_index(&self, x: usize, y: usize) -> Option<usize>
[src]
pub fn get(&self, x: usize, y: usize) -> Option<&Cell>
[src]
Returns a reference to the Cell
at the given coordinates, or None
if the index is out of
bounds.
Examples
let mut term = Terminal::new().unwrap(); let a_cell = term.get(5, 5);
pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Cell>
[src]
Returns a mutable reference to the Cell
at the given coordinates, or None
if the index
is out of bounds.
Examples
let mut term = Terminal::new().unwrap(); let a_mut_cell = term.get_mut(5, 5);
pub fn size(&self) -> (usize, usize)
[src]
pub fn cellvec(&self) -> &Vec<Cell>
[src]
pub fn cellvec_mut(&mut self) -> &mut Vec<Cell>
[src]
pub fn cols(&self) -> usize
[src]
pub fn rows(&self) -> usize
[src]
pub fn scroll_up(
&mut self,
scroll_region: &ScrollRegion,
top: usize,
offset: usize
)
[src]
&mut self,
scroll_region: &ScrollRegion,
top: usize,
offset: usize
)
Performs the normal scroll up motion:
First clear offset number of lines:
For offset = 1, top = 1:
| 111111111111 | | |
| 222222222222 | | 222222222222 |
| 333333333333 | | 333333333333 |
| 444444444444 | --> | 444444444444 |
| 555555555555 | | 555555555555 |
| 666666666666 | | 666666666666 |
In each step, swap the current line with the next by offset:
| | | 222222222222 |
| 222222222222 | | |
| 333333333333 | | 333333333333 |
| 444444444444 | --> | 444444444444 |
| 555555555555 | | 555555555555 |
| 666666666666 | | 666666666666 |
Result:
Before After
| 111111111111 | | 222222222222 |
| 222222222222 | | 333333333333 |
| 333333333333 | | 444444444444 |
| 444444444444 | | 555555555555 |
| 555555555555 | | 666666666666 |
| 666666666666 | | |
pub fn scroll_down(
&mut self,
scroll_region: &ScrollRegion,
top: usize,
offset: usize
)
[src]
&mut self,
scroll_region: &ScrollRegion,
top: usize,
offset: usize
)
Performs the normal scroll down motion:
First clear offset number of lines:
For offset = 1, top = 1:
| 111111111111 | | 111111111111 |
| 222222222222 | | 222222222222 |
| 333333333333 | | 333333333333 |
| 444444444444 | --> | 444444444444 |
| 555555555555 | | 555555555555 |
| 666666666666 | | |
In each step, swap the current line with the prev by offset:
| 111111111111 | | 111111111111 |
| 222222222222 | | 222222222222 |
| 333333333333 | | 333333333333 |
| 444444444444 | --> | 444444444444 |
| 555555555555 | | |
| | | 555555555555 |
Result:
Before After
| 111111111111 | | |
| 222222222222 | | 111111111111 |
| 333333333333 | | 222222222222 |
| 444444444444 | | 333333333333 |
| 555555555555 | | 444444444444 |
| 666666666666 | | 555555555555 |
pub fn bounds_iter(&self, area: Area) -> BoundsIteratorⓘNotable traits for BoundsIterator
impl Iterator for BoundsIterator type Item = RowIterator;
[src]
Notable traits for BoundsIterator
impl Iterator for BoundsIterator type Item = RowIterator;
See BoundsIterator
documentation.
pub fn row_iter(&self, bounds: Range<usize>, row: usize) -> RowIteratorⓘNotable traits for RowIterator
impl Iterator for RowIterator type Item = (usize, usize);
[src]
Notable traits for RowIterator
impl Iterator for RowIterator type Item = (usize, usize);
See RowIterator
documentation.
pub fn tag_associations(&self) -> SmallVec<[(usize, u64, bool); 128]>
[src]
pub fn tag_table(&self) -> &HashMap<u64, FormatTag>
[src]
pub fn tag_table_mut(&mut self) -> &mut HashMap<u64, FormatTag>
[src]
pub fn insert_tag(&mut self, tag: FormatTag) -> u64
[src]
pub fn set_tag(&mut self, tag: u64, start: (usize, usize), end: (usize, usize))
[src]
Trait Implementations
impl Clone for CellBuffer
[src]
fn clone(&self) -> CellBuffer
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CellBuffer
[src]
impl Default for CellBuffer
[src]
fn default() -> CellBuffer
[src]
Constructs a new CellBuffer
with a size of (0, 0)
, using the default Cell
as a blank.
impl Deref for CellBuffer
[src]
impl DerefMut for CellBuffer
[src]
impl Display for CellBuffer
[src]
impl Eq for CellBuffer
[src]
impl Index<(usize, usize)> for CellBuffer
[src]
impl IndexMut<(usize, usize)> for CellBuffer
[src]
impl KMP for CellBuffer
[src]
fn kmp_search(&self, pattern: &str) -> SmallVec<[usize; 256]>
[src]
fn kmp_table(graphemes: &[&str]) -> SmallVec<[i32; 256]>
[src]
impl PartialEq<CellBuffer> for CellBuffer
[src]
fn eq(&self, other: &CellBuffer) -> bool
[src]
fn ne(&self, other: &CellBuffer) -> bool
[src]
impl StructuralEq for CellBuffer
[src]
impl StructuralPartialEq for CellBuffer
[src]
Auto Trait Implementations
impl RefUnwindSafe for CellBuffer
impl Send for CellBuffer
impl Sync for CellBuffer
impl Unpin for CellBuffer
impl UnwindSafe for CellBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,