pub struct TileFlags(/* private fields */);Expand description
Bit-flags tracking a tile’s emptiness and its role in any multi-cell structure it is part of: a wide character, or a span.
Implementations§
Source§impl TileFlags
impl TileFlags
Sourcepub const WIDE_CHAR_SPACER: TileFlags
pub const WIDE_CHAR_SPACER: TileFlags
This tile is the invisible right-half spacer of a wide character.
Sourcepub const EMPTY: TileFlags
pub const EMPTY: TileFlags
No content has been written to this tile: it is fully transparent.
Set on Tile::default and cleared by every write. Compositing
(Grid::blit, layer flattening) skips
empty tiles, so an explicit space (which is not empty) is opaque
and overwrites lower layers, while an untouched cell is not.
Sourcepub const HAS_EXTRA: TileFlags
pub const HAS_EXTRA: TileFlags
This tile has an entry in its layer’s sparse EGC side-table
(see Grid’s internal LayerBuf::extras), because it holds a
multi-codepoint grapheme cluster (combining marks, ZWJ sequences).
This flag is authoritative for whether extra text exists: code
that reads a tile’s grapheme must check this bit first and treat
the side-table as backing storage only, never the other way
around. Tile cannot carry the string itself and stay small; the split is
what keeps the common single-codepoint tile compact.
Sourcepub const SPAN_ANCHOR: TileFlags
pub const SPAN_ANCHOR: TileFlags
This tile is the top-left anchor of a multi-cell span: it occupies
Tile::span cells, not one.
Written only by Grid::write_span, which also writes
the matching SPAN_COVERED tiles. An anchor without its covered
cells is a broken invariant, which is why there is no Tile builder for this flag.
Sourcepub const SPAN_COVERED: TileFlags
pub const SPAN_COVERED: TileFlags
This tile is covered by a multi-cell span anchored above and/or to its left; see
Tile::span_offset.
Unlike WIDE_CHAR_SPACER, a covered tile keeps a real glyph
and is rendered by cell backends: that glyph is the span artwork’s text fallback.
Only a backend that actually draws the span’s artwork (a pixel backend blitting one
sprite across the whole footprint) skips it. See the grid module
docs for the full contract.
Source§impl TileFlags
impl TileFlags
Sourcepub const fn bits(&self) -> u8
pub const fn bits(&self) -> u8
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u8) -> Option<TileFlags>
pub const fn from_bits(bits: u8) -> Option<TileFlags>
Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u8) -> TileFlags
pub const fn from_bits_truncate(bits: u8) -> TileFlags
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u8) -> TileFlags
pub const fn from_bits_retain(bits: u8) -> TileFlags
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<TileFlags>
pub fn from_name(name: &str) -> Option<TileFlags>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: TileFlags) -> bool
pub const fn intersects(&self, other: TileFlags) -> bool
Whether any set bits in other are also set in self.
Sourcepub const fn contains(&self, other: TileFlags) -> bool
pub const fn contains(&self, other: TileFlags) -> bool
Whether all set bits in other are also set in self.
Sourcepub fn remove(&mut self, other: TileFlags)
pub fn remove(&mut self, other: TileFlags)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: TileFlags)
pub fn toggle(&mut self, other: TileFlags)
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub fn set(&mut self, other: TileFlags, value: bool)
pub fn set(&mut self, other: TileFlags, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: TileFlags) -> TileFlags
pub const fn intersection(self, other: TileFlags) -> TileFlags
The bitwise and (&) of the bits in self and other.
Sourcepub const fn union(self, other: TileFlags) -> TileFlags
pub const fn union(self, other: TileFlags) -> TileFlags
The bitwise or (|) of the bits in self and other.
Sourcepub const fn difference(self, other: TileFlags) -> TileFlags
pub const fn difference(self, other: TileFlags) -> TileFlags
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: TileFlags) -> TileFlags
pub const fn symmetric_difference(self, other: TileFlags) -> TileFlags
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub const fn complement(self) -> TileFlags
pub const fn complement(self) -> TileFlags
The bitwise negation (!) of the bits in self, truncating the result.
Source§impl TileFlags
impl TileFlags
Sourcepub const fn iter(&self) -> Iter<TileFlags>
pub const fn iter(&self) -> Iter<TileFlags>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<TileFlags>
pub const fn iter_names(&self) -> IterNames<TileFlags>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
Source§impl BitAndAssign for TileFlags
impl BitAndAssign for TileFlags
Source§fn bitand_assign(&mut self, other: TileFlags)
fn bitand_assign(&mut self, other: TileFlags)
The bitwise and (&) of the bits in self and other.
Source§impl BitOrAssign for TileFlags
impl BitOrAssign for TileFlags
Source§fn bitor_assign(&mut self, other: TileFlags)
fn bitor_assign(&mut self, other: TileFlags)
The bitwise or (|) of the bits in self and other.
Source§impl BitXorAssign for TileFlags
impl BitXorAssign for TileFlags
Source§fn bitxor_assign(&mut self, other: TileFlags)
fn bitxor_assign(&mut self, other: TileFlags)
The bitwise exclusive-or (^) of the bits in self and other.
impl Copy for TileFlags
impl Eq for TileFlags
Source§impl Extend<TileFlags> for TileFlags
impl Extend<TileFlags> for TileFlags
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TileFlags>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TileFlags>,
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for TileFlags
impl Flags for TileFlags
Source§fn from_bits_retain(bits: u8) -> TileFlags
fn from_bits_retain(bits: u8) -> TileFlags
§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS].§fn iter_equal_names(&self) -> IterEqualNames<Self>
fn iter_equal_names(&self) -> IterEqualNames<Self>
§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.§fn set(&mut self, other: Self, value: bool)where
Self: Sized,
fn set(&mut self, other: Self, value: bool)where
Self: Sized,
Flags::insert] when value is true or [Flags::remove] when value is false.§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl FromIterator<TileFlags> for TileFlags
impl FromIterator<TileFlags> for TileFlags
Source§impl IntoIterator for TileFlags
impl IntoIterator for TileFlags
impl StructuralPartialEq for TileFlags
Source§impl Sub for TileFlags
impl Sub for TileFlags
Auto Trait Implementations§
impl Freeze for TileFlags
impl RefUnwindSafe for TileFlags
impl Send for TileFlags
impl Sync for TileFlags
impl Unpin for TileFlags
impl UnsafeUnpin for TileFlags
impl UnwindSafe for TileFlags
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> WasmNotSend for Twhere
T: Send,
impl<T> WasmNotSendSync for Twhere
T: WasmNotSend + WasmNotSync,
impl<T> WasmNotSync for Twhere
T: Sync,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).