/// A wrapper for displaying Naga IR terms in debugging output. /// /// This is like [`DiagnosticDisplay`], but requires weaker context /// and produces correspondingly lower-fidelity output. For example, /// this cannot show the override names for override-sized array /// lengths. /// /// [`DiagnosticDisplay`]: super::DiagnosticDisplay pubstruct DiagnosticDebug<T>(pub T);
impl fmt::Debug for DiagnosticDebug<(Handle<Type>, &UniqueArena<Type>)> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (handle, ctx) = self.0;
pubtrait ForDebug: Sized { /// Format this type using [`core::fmt::Debug`]. /// /// Return a value that implements the [`core::fmt::Debug`] trait /// by displaying `self` in a language-appropriate way. For /// example: /// /// # use naga::common::ForDebug; /// # let scalar: naga::Scalar = naga::Scalar::F32; /// log::debug!("My scalar: {:?}", scalar.for_debug()); fn for_debug(self) -> DiagnosticDebug<Self> {
DiagnosticDebug(self)
}
}
impl ForDebug for Scalar {}
pubtrait ForDebugWithTypes: Sized { /// Format this type using [`core::fmt::Debug`]. /// /// Given an arena to look up type handles in, return a value that /// implements the [`core::fmt::Debug`] trait by displaying `self` /// in a language-appropriate way. For example: /// /// # use naga::{Span, Type, TypeInner, Scalar, UniqueArena}; /// # use naga::common::ForDebugWithTypes; /// # let mut types = UniqueArena::<Type>::default(); /// # let inner = TypeInner::Scalar(Scalar::F32); /// # let span = Span::UNDEFINED; /// # let handle = types.insert(Type { name: None, inner }, span); /// log::debug!("My type: {:?}", handle.for_debug(&types)); fn for_debug(self, types: &UniqueArena<Type>) -> DiagnosticDebug<(Self, &UniqueArena<Type>)> {
DiagnosticDebug((self, types))
}
}
impl ForDebugWithTypes for Handle<Type> {} impl ForDebugWithTypes for &TypeInner {} impl ForDebugWithTypes for &TypeResolution {}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.