Skip to main content

Cell

Enum Cell 

Source
pub enum Cell {
    Strokes(StrokeCell),
    Literal(Glyph),
    Symbol(SymbolCell),
}
Expand description

A cell: either a base stroke with four arms, one chosen glyph, or a named symbol rendered through the catalog. The three kinds are mutually exclusive — no cell is two and none is neither — per The cell in docs/model.md.

Where a figure in front stamps over one behind, the kind on top decides which kind the position ends up being, exactly as it decides the base stroke of a StrokeCell: see Stamping in docs/model.md.

Variants§

§

Strokes(StrokeCell)

A base stroke and four arms.

§

Literal(Glyph)

One chosen glyph. Nothing connects into it, and it renders as itself without consulting any catalog.

§

Symbol(SymbolCell)

A symbol and the style it is drawn in. Nothing connects into it, and the catalog the renderer was handed answers the pair — or does not, which is a space.

Implementations§

Source§

impl Cell

Source

pub fn is_decided(&self) -> bool

Whether the cell is already decided. For Cell::Strokes this is StrokeCell::is_decided; a Cell::Literal and a Cell::Symbol are decided on all four sides by definition, since neither has an arm to leave undecided.

Source

pub fn glyph_str<'a>(&'a self, glyphs: &'a GlyphCatalog) -> Option<&'a str>

The text this cell renders to. A literal answers with its own text directly, without consulting glyphs; a symbol answers with the glyph filed under its pair, and nothing if the catalog holds no such pair; a stroke cell is looked up by StrokeCell::key first and StrokeCell::degraded_key second, answering None if glyphs has no rule for either. See Rendering in docs/model.md.

Trait Implementations§

Source§

impl Clone for Cell

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Cell

Source§

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

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

impl Eq for Cell

Source§

impl From<StrokeCell> for Cell

Source§

fn from(cell: StrokeCell) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Cell

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Cell

Auto Trait Implementations§

§

impl Forget for Cell

§

impl Freeze for Cell

§

impl RefUnwindSafe for Cell

§

impl Send for Cell

§

impl Sync for Cell

§

impl Unpin for Cell

§

impl UnsafeUnpin for Cell

§

impl UnwindSafe for Cell

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.