class WeakInspector

Defined at line 116 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/inspector.h

A weak handle to an Inspector.

Can be safely captured by value in lazy node callbacks.

Using WeakInspector avoids:

1. Reference cycles: Capturing a strong Inspector by value in a callback owned

by that Inspector creates a cycle, preventing destruction.

2. Dangling pointers: Capturing a strong Inspector by reference (or raw pointer)

is unsafe because Inspector is copyable. The original Inspector instance

might be destroyed while a copy keeps the underlying state (and the callback)

alive.

Public Methods

Inspector lock ()

Attempts to promote this weak handle to a strong Inspector handle.

Returns a full-fledged copy of the original Inspector if all internal shared

objects are still alive, or a no-op Inspector (which evaluates to false in

boolean contexts) if the original Inspector was destroyed.

Defined at line 83 of file ../../zircon/system/ulib/inspect/inspector.cc

void WeakInspector ()

Defined at line 118 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/inspector.h

bool operator bool ()

Returns true if the underlying state has not been destroyed.

Defined at line 128 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/inspector.h

Friends

class Inspector