Skip to main content

Inspect

Trait Inspect 

Source
pub trait Inspect {
    // Required method
    fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>;
}
Expand description

Provides structured introspection of a Rust value.

This trait allows types to expose their structure and content in a way that tools, debuggers, and renderers can consume without requiring specific serialization formats or coupling to UI frameworks.

§Deriving

The recommended way to implement Inspect is via the derive macro:

use inspect_rs::Inspect;

#[derive(Inspect)]
struct User {
    id: u64,
    name: String,
}

§Manual implementation

For types that need custom introspection logic:

use inspect_core::{Inspect, InspectCx, ValueRef, Kind, TypeInfo};

struct Custom(u32);

impl Inspect for Custom {
    fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_> {
        ValueRef::with_type(
            Kind::U32(self.0),
            TypeInfo::new("Custom"),
        )
    }
}

Required Methods§

Source

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Inspect this value and return a borrowed structured representation.

§Parameters
  • cx: Inspection context containing configuration, limits, and state
§Performance

This method should be cheap to call. Avoid allocating entire trees or traversing large collections. Use lazy child enumeration instead.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Inspect for &[u8]

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for ()

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for String

Available on crate feature std only.
Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for bool

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for char

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for f32

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for f64

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for i8

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for i16

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for i32

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for i64

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for i128

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for isize

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for str

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for u8

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for u16

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for u32

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for u64

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for u128

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl Inspect for usize

Source§

fn inspect(&self, _cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<K, V> Inspect for HashMap<K, V>
where K: Inspect, V: Inspect,

Available on crate feature std only.
Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T0, T1, T2> Inspect for (T0, T1, T2)
where T0: Inspect, T1: Inspect, T2: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T0, T1> Inspect for (T0, T1)
where T0: Inspect, T1: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T0> Inspect for (T0,)
where T0: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T, E> Inspect for Result<T, E>
where T: Inspect, E: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T, const N: usize> Inspect for [T; N]
where T: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for &T
where T: Inspect + ?Sized,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for &mut T
where T: Inspect + ?Sized,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for Box<T>
where T: Inspect + ?Sized,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for HashSet<T>
where T: Inspect,

Available on crate feature std only.
Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for Option<T>
where T: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Source§

impl<T> Inspect for Vec<T>
where T: Inspect,

Source§

fn inspect(&self, cx: &mut InspectCx<'_>) -> ValueRef<'_>

Implementors§