pub struct DiagnosticLog { /* private fields */ }Expand description
The dedup state behind every render-time diagnostic a windowed renderer can emit.
Each graphical backend holds one DiagnosticLog field (Default-constructed) instead of a
separate BTreeSet<char> per diagnostic, so the diagnostics a backend emits are exactly this
struct’s methods, not something a reader has to reconstruct by finding every warned_* field
and the free function it feeds. The methods here are thin wrappers over the free functions in
this module and in sprite_cache, which remain the implementation and
stay public for any caller that wants the dedup set itself rather than one owned alongside the
others.
Constructing a DiagnosticLog never allocates: every set starts empty, and
BTreeSet::default does not allocate until its first insert, so a release build (where every
method’s body is compiled out by dev_only!) pays nothing for carrying this field.
Implementations§
Source§impl DiagnosticLog
impl DiagnosticLog
Sourcepub fn notdef_glyph(&mut self, ch: char) -> bool
pub fn notdef_glyph(&mut self, ch: char) -> bool
Reports ch if it resolved to the fallback notdef glyph rather than its own, at most once
per character. See warn_notdef_glyph for what this means and why it is worth a
diagnostic.
Sourcepub fn sprite_needs_span(
&mut self,
glyph: char,
sprite: (u32, u32),
cell: (u32, u32),
) -> bool
pub fn sprite_needs_span( &mut self, glyph: char, sprite: (u32, u32), cell: (u32, u32), ) -> bool
Reports glyph’s sprite as drawn without a span reserving the cells it covers, at most
once per glyph. See warn_sprite_needs_span for the full contract.
Sourcepub fn tint_needs_sprite(&mut self, glyph: char, tint: Tint) -> bool
pub fn tint_needs_sprite(&mut self, glyph: char, tint: Tint) -> bool
Reports glyph’s tint as dropped because it resolved to a bitmap font glyph rather than a
sprite, at most once per glyph. See warn_tint_needs_sprite for the full contract.
Sourcepub fn has_reported_notdef(&self, ch: char) -> bool
pub fn has_reported_notdef(&self, ch: char) -> bool
Whether notdef_glyph has already reported ch.
For a backend’s own test suite to assert the dedup behavior directly; production code only
ever needs notdef_glyph’s own return value.
Sourcepub fn has_reported_dropped_tint(&self, glyph: char) -> bool
pub fn has_reported_dropped_tint(&self, glyph: char) -> bool
Whether tint_needs_sprite has already reported glyph.
For a backend’s own test suite to assert the dedup behavior directly; production code only
ever needs tint_needs_sprite’s own return value.
Sourcepub fn dropped_tint_report_count(&self) -> usize
pub fn dropped_tint_report_count(&self) -> usize
How many distinct glyphs tint_needs_sprite has reported so
far.
For a backend’s own test suite to assert dedup collapses repeat reports to one; production code has no use for the count.
Trait Implementations§
Source§impl Debug for DiagnosticLog
impl Debug for DiagnosticLog
Source§impl Default for DiagnosticLog
impl Default for DiagnosticLog
Source§fn default() -> DiagnosticLog
fn default() -> DiagnosticLog
Auto Trait Implementations§
impl Freeze for DiagnosticLog
impl RefUnwindSafe for DiagnosticLog
impl Send for DiagnosticLog
impl Sync for DiagnosticLog
impl Unpin for DiagnosticLog
impl UnsafeUnpin for DiagnosticLog
impl UnwindSafe for DiagnosticLog
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
§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.