pub struct TermelMeta { /* private fields */ }term only.Expand description
๐ฎ ๐ ๐งฑ โซ๏ธ
Compact terminal-cell occupancy metadata for a Termel.
๐ sys/os/term/grid
๐ฆ size_of::<TermelMeta>() == 1 bytes
An origin stores its occupied column width. A continuation stores its backward offset to the origin.
Widths and offsets range from 1 to 15 columns.
Implementationsยง
Sourceยงimpl TermelMeta
impl TermelMeta
Sourcepub const fn origin(width: u8) -> Option<Self> โ
pub const fn origin(width: u8) -> Option<Self> โ
Creates metadata for an element origin.
Returns None when width is zero or exceeds Self::MAX_SPAN.
Sourcepub const fn continuation(origin_offset: u8) -> Option<Self> โ
pub const fn continuation(origin_offset: u8) -> Option<Self> โ
Creates metadata for an element continuation.
origin_offset is the number of columns back to the origin.
Returns None when it is zero or exceeds Self::MAX_SPAN.
Sourcepub const fn occupancy(self) -> TermelOccupancy
pub const fn occupancy(self) -> TermelOccupancy
Returns the occupancy kind.
Sourcepub const fn is_occupied(self) -> bool
pub const fn is_occupied(self) -> bool
Returns whether this position is occupied.
Sourcepub const fn is_unoccupied(self) -> bool
pub const fn is_unoccupied(self) -> bool
Returns whether this position is empty.
Sourcepub const fn is_continuation(self) -> bool
pub const fn is_continuation(self) -> bool
Returns whether this position continues an earlier element.
Sourcepub const fn origin_offset(self) -> Option<u8> โ
pub const fn origin_offset(self) -> Option<u8> โ
Returns the backward distance to the origin when this is a continuation.
Sourcepub const fn is_canonical(self) -> bool
pub const fn is_canonical(self) -> bool
Returns whether this value has a valid canonical representation.
Sourceยงimpl TermelMeta
ยงNamed bit field masks.
These constants represent each fieldโs occupied bit range, not a field value.
impl TermelMeta
ยงNamed bit field masks.
These constants represent each fieldโs occupied bit range, not a field value.
Use them with mask-level methods such as
contains_mask, with_mask and without_mask.
Sourceยงimpl TermelMeta
impl TermelMeta
Sourcepub const fn is_full(self) -> bool
pub const fn is_full(self) -> bool
Returns true if the raw bits exactly equal the declared field mask.
Sourcepub const fn fields_are_zero(self) -> bool
pub const fn fields_are_zero(self) -> bool
Returns true if all declared field bits are clear.
Sourcepub const fn fields_are_full(self) -> bool
pub const fn fields_are_full(self) -> bool
Returns true if all declared field bits are set.
Sourcepub const fn contains_mask(self, other: Self) -> bool
pub const fn contains_mask(self, other: Self) -> bool
Returns true if all bits in other are set in self.
This is a mask-level predicate. When used with a named field constant, it checks whether every bit occupied by that field is set.
Sourcepub const fn has_extra_bits(self) -> bool
pub const fn has_extra_bits(self) -> bool
Returns true if any bit outside the declared field mask is set.
Sourcepub const fn clear_fields(&mut self)
pub const fn clear_fields(&mut self)
Clears all declared field bits, preserving bits outside the declared field mask.
Sourcepub const fn without_fields(self) -> Self
pub const fn without_fields(self) -> Self
Returns self with all declared field bits cleared, preserving extra bits.
Sourcepub const fn with_mask(self, other: Self) -> Self
pub const fn with_mask(self, other: Self) -> Self
Returns self with all bits in other set.
This is a mask-level operation. Use with_FIELD(value) to replace a field value.
Sourcepub const fn with_mask_if(self, condition: bool, other: Self) -> Self
pub const fn with_mask_if(self, condition: bool, other: Self) -> Self
Returns self with all bits in other set if condition is true.
Sourcepub const fn without_mask(self, other: Self) -> Self
pub const fn without_mask(self, other: Self) -> Self
Returns self with all bits in other cleared.
This is a mask-level operation. It clears the occupied bits, regardless of the current field value.
Sourcepub const fn without_mask_if(self, condition: bool, other: Self) -> Self
pub const fn without_mask_if(self, condition: bool, other: Self) -> Self
Returns self with all bits in other cleared if condition is true.
Sourceยงimpl TermelMeta
impl TermelMeta
Sourcepub const fn with_kind(self, value: u8) -> Self
pub const fn with_kind(self, value: u8) -> Self
Returns self with the field value replaced, masking it to fit the field width.
Sourcepub const fn try_with_kind(self, value: u8) -> Result<Self, MismatchedCapacity> โ
pub const fn try_with_kind(self, value: u8) -> Result<Self, MismatchedCapacity> โ
Returns self with the checked field value replaced, if it fits.
Sourcepub const fn set_kind(&mut self, value: u8)
pub const fn set_kind(&mut self, value: u8)
Replaces the field value, masking it to fit the field width.
Sourcepub const fn try_set_kind(
&mut self,
value: u8,
) -> Result<(), MismatchedCapacity> โ
pub const fn try_set_kind( &mut self, value: u8, ) -> Result<(), MismatchedCapacity> โ
Replaces the field value, if it fits.
Sourcepub const fn clear_kind(&mut self)
pub const fn clear_kind(&mut self)
Clears the field value.
Sourcepub const fn is_kind_zero(self) -> bool
pub const fn is_kind_zero(self) -> bool
Returns true if the field value is zero.
Sourcepub const fn is_kind_max(self) -> bool
pub const fn is_kind_max(self) -> bool
Returns true if the field value equals its maximum.
Sourceยงimpl TermelMeta
impl TermelMeta
Sourcepub const fn with_value(self, value: u8) -> Self
pub const fn with_value(self, value: u8) -> Self
Returns self with the field value replaced, masking it to fit the field width.
Sourcepub const fn try_with_value(self, value: u8) -> Result<Self, MismatchedCapacity> โ
pub const fn try_with_value(self, value: u8) -> Result<Self, MismatchedCapacity> โ
Returns self with the checked field value replaced, if it fits.
Sourcepub const fn set_value(&mut self, value: u8)
pub const fn set_value(&mut self, value: u8)
Replaces the field value, masking it to fit the field width.
Sourcepub const fn try_set_value(
&mut self,
value: u8,
) -> Result<(), MismatchedCapacity> โ
pub const fn try_set_value( &mut self, value: u8, ) -> Result<(), MismatchedCapacity> โ
Replaces the field value, if it fits.
Sourcepub const fn clear_value(&mut self)
pub const fn clear_value(&mut self)
Clears the field value.
Sourcepub const fn is_value_zero(self) -> bool
pub const fn is_value_zero(self) -> bool
Returns true if the field value is zero.
Sourcepub const fn is_value_max(self) -> bool
pub const fn is_value_max(self) -> bool
Returns true if the field value equals its maximum.
Sourcepub const fn value_span() -> BitSpan<u8>
pub const fn value_span() -> BitSpan<u8>
Returns metadata for this field.
Trait Implementationsยง
Sourceยงimpl Binary for TermelMeta
Formats the set as a binary mask over its declared bit domain.
impl Binary for TermelMeta
Formats the set as a binary mask over its declared bit domain.
Sourceยงimpl BitSized<{ $Bitfield::_BITFIELD_BIT_SIZE }> for TermelMeta
impl BitSized<{ $Bitfield::_BITFIELD_BIT_SIZE }> for TermelMeta
Sourceยงconst BIT_SIZE: usize = _
const BIT_SIZE: usize = _
Sourceยงconst MIN_BYTE_SIZE: usize = _
const MIN_BYTE_SIZE: usize = _
Sourceยงfn bit_size(&self) -> usize
fn bit_size(&self) -> usize
Sourceยงfn min_byte_size(&self) -> usize
fn min_byte_size(&self) -> usize
Sourceยงimpl Clone for TermelMeta
impl Clone for TermelMeta
Sourceยงfn clone(&self) -> TermelMeta
fn clone(&self) -> TermelMeta
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl ConstInit for TermelMeta
impl ConstInit for TermelMeta
impl Copy for TermelMeta
Sourceยงimpl Debug for TermelMeta
Formats the bitfield as named field values.
impl Debug for TermelMeta
Formats the bitfield as named field values.
Sourceยงimpl DebugExt for TermelMetawhere
TermelMeta: Debug,
impl DebugExt for TermelMetawhere
TermelMeta: Debug,
Sourceยงimpl Default for TermelMeta
impl Default for TermelMeta
Sourceยงimpl Display for TermelMeta
Formats the bitfield as compact named field values.
impl Display for TermelMeta
Formats the bitfield as compact named field values.
impl Eq for TermelMeta
Sourceยงimpl Hash for TermelMeta
impl Hash for TermelMeta
Sourceยงimpl LowerHex for TermelMeta
Formats the set as a hexadecimal mask over its declared bit domain.
impl LowerHex for TermelMeta
Formats the set as a hexadecimal mask over its declared bit domain.
Sourceยงimpl Octal for TermelMeta
Formats the set as an octal mask over its declared bit domain.
impl Octal for TermelMeta
Formats the set as an octal mask over its declared bit domain.
Sourceยงimpl Ord for TermelMeta
impl Ord for TermelMeta
1.21.0 (const: unstable) ยท Sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงimpl PartialEq for TermelMeta
impl PartialEq for TermelMeta
Sourceยงimpl PartialOrd for TermelMeta
impl PartialOrd for TermelMeta
Auto Trait Implementationsยง
impl Freeze for TermelMeta
impl RefUnwindSafe for TermelMeta
impl Send for TermelMeta
impl Sync for TermelMeta
impl Unpin for TermelMeta
impl UnsafeUnpin for TermelMeta
impl UnwindSafe for TermelMeta
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.