pub struct DebugJSON<T: Serialize>(pub T);Expand description
This type is primarily useful inside printer implementations when you want a low-friction way to inspect an AST fragment.
§What it does
- Appends a JSON representation of the wrapped value to
"/tmp/hax-ast-debug.json"(one JSON document per line). - Implements
std::fmt::Displayto print ajustinvocation you can paste in a shell to re-open that same JSON by line number:just debug-json <line-id>
§Example
let s = Small { x: 42 };
// Prints something like: `just debug-json 17`.
println!("{}", DebugJSON(&s));
// Running `just debug-json 17` will print `{"x":42}`§Notes
- This is a debugging convenience and intentionally has a side-effect (file write). Avoid keeping it in user-facing output paths.
- The file grows over time; occasionally delete it if you no longer need historical entries.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<A: 'static + Clone, P, T: Serialize + Debug> ToDocument<P, A> for DebugJSON<T>
impl<A: 'static + Clone, P, T: Serialize + Debug> ToDocument<P, A> for DebugJSON<T>
Source§fn to_document(&self, _: &P) -> DocBuilder<A>
fn to_document(&self, _: &P) -> DocBuilder<A>
Produce a document using the provided printer reference.
Auto Trait Implementations§
impl<T> Freeze for DebugJSON<T>where
T: Freeze,
impl<T> RefUnwindSafe for DebugJSON<T>where
T: RefUnwindSafe,
impl<T> Send for DebugJSON<T>where
T: Send,
impl<T> Sync for DebugJSON<T>where
T: Sync,
impl<T> Unpin for DebugJSON<T>where
T: Unpin,
impl<T> UnsafeUnpin for DebugJSON<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for DebugJSON<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more