Skip to main content

DebugValue

Enum DebugValue 

Source
pub enum DebugValue {
    Int(i32),
    Float(f32),
    Bool(bool),
    Str(String),
    Null,
    List(Vec<String>),
    DivertTarget(Option<String>),
    Struct {
        name: Option<String>,
        fields: Vec<(String, DebugValue)>,
    },
    Handle {
        kind: String,
        id: u64,
    },
    Other(String),
}
Expand description

A structured, read-only view of a runtime Value for the debugger’s locals panel (docs/debugger-spec.md §3, D7/#3185).

Why structured, not another display string. DebugGlobal::value is a display string (String) — that shape predates this ticket and stays as-is (globals are out of D7’s scope, and changing an existing public field is not “additive”). For locals, a display string is the wrong shape to repeat: the issue’s own bar is that a debugger which can only show "[list]" for a list value is not the target, and a plain string can’t do better than that — a studio locals panel needs to tell “this is a list with these members” from “this is a string that reads like a list” to render either one correctly (or let a user expand a struct’s fields, or distinguish a null from an empty string). So D7 exposes the value’s kind structurally for every kind the runtime distinguishes that the issue calls out by name (int, float, string, list, divert target, struct, handle), plus the common bool/null cases that cost nothing extra to model — and falls back to the existing [NameResolver::format_value] display string (DebugValue::Other) for the long tail of kinds this ticket has no author-facing UI need to special-case yet (closures, arrays, maps, weighted tables, function refs, variable/temp pointers, fragment refs, vector/matrix/quaternion, ranges, options, projections). Other is not a cop-out for the kinds the issue named — those all get real variants below.

Variants§

§

Int(i32)

§

Float(f32)

§

Bool(bool)

§

Str(String)

§

Null

§

List(Vec<String>)

A list value’s member names, in list order (unresolvable items are skipped, matching NameResolver::format_value’s existing behavior).

§

DivertTarget(Option<String>)

A divert-target value, resolved to its author-facing knot/stitch path where possible. None when the target isn’t resolvable to a named scope (matches format_value’s "-> ?" case).

§

Struct

A struct (Value::Record) value: its declared shape name (if resolvable) and its fields, named and recursively structured.

Fields

§fields: Vec<(String, DebugValue)>
§

Handle

A handle value (T1d): its manifest-declared kind name and the host-allocated token id.

Fields

§kind: String
§id: u64
§

Other(String)

Every other value kind’s existing display-string form ([NameResolver::format_value]) — see this enum’s own doc for why.

Trait Implementations§

Source§

impl Clone for DebugValue

Source§

fn clone(&self) -> DebugValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DebugValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.