pub trait Introspect {
// Required methods
fn introspect_value(&self) -> String;
fn introspect_child<'a>(
&'a self,
index: usize,
) -> Option<Box<dyn IntrospectItem<'a> + 'a>>;
// Provided method
fn introspect_len(&self) -> usize { ... }
}
Expand description
Gives the ability to look into an object, inspecting any children (fields).
Required Methods§
sourcefn introspect_value(&self) -> String
fn introspect_value(&self) -> String
Returns the value of the object, excluding children, as a string. Exactly what the value returned here is depends on the type. For some types, like a plain array, there isn’t much of a value, the entire information of object resides in the children. For other cases, like a department in an organisation, it might make sense to have the value be the name, and have all the other properties as children.
sourcefn introspect_child<'a>(
&'a self,
index: usize,
) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
fn introspect_child<'a>( &'a self, index: usize, ) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
Returns an the name and &dyn Introspect for the child with the given index, or if no child with that index exists, None. All the children should be indexed consecutively starting at 0 with no gaps, all though there isn’t really anything stopping the user of the trait to have any arbitrary index strategy, consecutive numbering 0, 1, 2, … etc is strongly encouraged.
Provided Methods§
sourcefn introspect_len(&self) -> usize
fn introspect_len(&self) -> usize
Returns the total number of children. The default implementation calculates this by simply calling introspect_child with higher and higher indexes until it returns None. It gives up if the count reaches 10000. If your type can be bigger and you want to be able to introspect it, override this method.
Implementations on Foreign Types§
source§impl Introspect for bool
impl Introspect for bool
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for char
impl Introspect for char
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for f32
impl Introspect for f32
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for f64
impl Introspect for f64
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for i8
impl Introspect for i8
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for i16
impl Introspect for i16
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for i32
impl Introspect for i32
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for i64
impl Introspect for i64
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for i128
impl Introspect for i128
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for isize
impl Introspect for isize
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for str
impl Introspect for str
fn introspect_value(&self) -> String
fn introspect_child(&self, _index: usize) -> Option<Box<dyn IntrospectItem<'_>>>
source§impl Introspect for u8
impl Introspect for u8
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for u16
impl Introspect for u16
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for u32
impl Introspect for u32
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for u64
impl Introspect for u64
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for u128
impl Introspect for u128
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for ()
impl Introspect for ()
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for usize
impl Introspect for usize
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for String
impl Introspect for String
fn introspect_value(&self) -> String
fn introspect_child(&self, _index: usize) -> Option<Box<dyn IntrospectItem<'_>>>
source§impl Introspect for Arc<str>
impl Introspect for Arc<str>
fn introspect_value(&self) -> String
fn introspect_child(&self, _index: usize) -> Option<Box<dyn IntrospectItem<'_>>>
fn introspect_len(&self) -> usize
source§impl Introspect for AtomicBool
impl Introspect for AtomicBool
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicI8
impl Introspect for AtomicI8
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicI16
impl Introspect for AtomicI16
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicI32
impl Introspect for AtomicI32
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicI64
impl Introspect for AtomicI64
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicIsize
impl Introspect for AtomicIsize
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicU8
impl Introspect for AtomicU8
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicU16
impl Introspect for AtomicU16
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicU32
impl Introspect for AtomicU32
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicU64
impl Introspect for AtomicU64
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for AtomicUsize
impl Introspect for AtomicUsize
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for Duration
impl Introspect for Duration
fn introspect_value(&self) -> String
fn introspect_child<'a>( &'a self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
fn introspect_len(&self) -> usize
source§impl Introspect for PathBuf
impl Introspect for PathBuf
fn introspect_value(&self) -> String
fn introspect_child(&self, _index: usize) -> Option<Box<dyn IntrospectItem<'_>>>
source§impl Introspect for Instant
impl Introspect for Instant
fn introspect_value(&self) -> String
fn introspect_child<'a>( &'a self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
source§impl Introspect for SystemTime
impl Introspect for SystemTime
fn introspect_value(&self) -> String
fn introspect_child<'a>( &'a self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
fn introspect_len(&self) -> usize
source§impl Introspect for BitSet
impl Introspect for BitSet
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for BitSet
impl Introspect for BitSet
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for BitVec
impl Introspect for BitVec
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl Introspect for BitVec
impl Introspect for BitVec
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<'a, T: 'a + Introspect + ToOwned + ?Sized> Introspect for Cow<'a, T>
impl<'a, T: 'a + Introspect + ToOwned + ?Sized> Introspect for Cow<'a, T>
fn introspect_value(&self) -> String
fn introspect_child<'b>( &'b self, index: usize, ) -> Option<Box<dyn IntrospectItem<'b> + 'b>>
fn introspect_len(&self) -> usize
source§impl<'a, T: Introspect> Introspect for Ref<'a, T>
impl<'a, T: Introspect> Introspect for Ref<'a, T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K, V: Introspect, S: BuildHasher> Introspect for HashMap<K, V, S>
impl<K, V: Introspect, S: BuildHasher> Introspect for HashMap<K, V, S>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K, V: Introspect, S: BuildHasher> Introspect for IndexMap<K, V, S>
impl<K, V: Introspect, S: BuildHasher> Introspect for IndexMap<K, V, S>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K: Introspect + Eq + Hash, S: BuildHasher> Introspect for HashSet<K, S>
impl<K: Introspect + Eq + Hash, S: BuildHasher> Introspect for HashSet<K, S>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K: Introspect + Eq + Hash, S: BuildHasher> Introspect for IndexSet<K, S>
impl<K: Introspect + Eq + Hash, S: BuildHasher> Introspect for IndexSet<K, S>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K: Introspect + Eq + Hash, V: Introspect, S: BuildHasher> Introspect for HashMap<K, V, S>
impl<K: Introspect + Eq + Hash, V: Introspect, S: BuildHasher> Introspect for HashMap<K, V, S>
default fn introspect_value(&self) -> String
default fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
default fn introspect_len(&self) -> usize
source§impl<K: Introspect + Eq + Hash, V: Introspect, S: BuildHasher> Introspect for IndexMap<K, V, S>
impl<K: Introspect + Eq + Hash, V: Introspect, S: BuildHasher> Introspect for IndexMap<K, V, S>
default fn introspect_value(&self) -> String
default fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
default fn introspect_len(&self) -> usize
source§impl<K: Introspect> Introspect for BTreeSet<K>
impl<K: Introspect> Introspect for BTreeSet<K>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<K: Introspect, V: Introspect> Introspect for BTreeMap<K, V>
impl<K: Introspect, V: Introspect> Introspect for BTreeMap<K, V>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T1: Introspect> Introspect for Range<T1>
impl<T1: Introspect> Introspect for Range<T1>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T1: Introspect, T2: Introspect> Introspect for (T1, T2)
impl<T1: Introspect, T2: Introspect> Introspect for (T1, T2)
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T1: Introspect, T2: Introspect, T3: Introspect> Introspect for (T1, T2, T3)
impl<T1: Introspect, T2: Introspect, T3: Introspect> Introspect for (T1, T2, T3)
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T1: Introspect, T2: Introspect, T3: Introspect, T4: Introspect> Introspect for (T1, T2, T3, T4)
impl<T1: Introspect, T2: Introspect, T3: Introspect, T4: Introspect> Introspect for (T1, T2, T3, T4)
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T> Introspect for PhantomData<T>
impl<T> Introspect for PhantomData<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, _index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T: Array> Introspect for SmallVec<T>where
T::Item: Introspect,
impl<T: Array> Introspect for SmallVec<T>where
T::Item: Introspect,
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Option<T>
impl<T: Introspect> Introspect for Option<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for (T,)
impl<T: Introspect> Introspect for (T,)
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T: Introspect> Introspect for Box<[T]>
impl<T: Introspect> Introspect for Box<[T]>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Box<T>
impl<T: Introspect> Introspect for Box<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for BinaryHeap<T>
impl<T: Introspect> Introspect for BinaryHeap<T>
fn introspect_value(&self) -> String
fn introspect_child<'a>( &'a self, index: usize, ) -> Option<Box<dyn IntrospectItem<'a> + 'a>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for VecDeque<T>
impl<T: Introspect> Introspect for VecDeque<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Rc<T>
impl<T: Introspect> Introspect for Rc<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Arc<[T]>
impl<T: Introspect> Introspect for Arc<[T]>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Arc<T>
impl<T: Introspect> Introspect for Arc<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Vec<T>
impl<T: Introspect> Introspect for Vec<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for RefCell<T>
impl<T: Introspect> Introspect for RefCell<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect> Introspect for Mutex<T>
impl<T: Introspect> Introspect for Mutex<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T: Introspect> Introspect for Mutex<T>
impl<T: Introspect> Introspect for Mutex<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<T: Introspect> Introspect for RwLock<T>
impl<T: Introspect> Introspect for RwLock<T>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect, R: Introspect> Introspect for Result<T, R>
impl<T: Introspect, R: Introspect> Introspect for Result<T, R>
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
fn introspect_len(&self) -> usize
source§impl<T: Introspect, const N: usize> Introspect for [T; N]
impl<T: Introspect, const N: usize> Introspect for [T; N]
fn introspect_value(&self) -> String
fn introspect_child( &self, index: usize, ) -> Option<Box<dyn IntrospectItem<'_> + '_>>
source§impl<V: Introspect + 'static, const C: usize> Introspect for ArrayVec<V, C>
impl<V: Introspect + 'static, const C: usize> Introspect for ArrayVec<V, C>
fn introspect_value(&self) -> String
fn introspect_child<'s>( &'s self, index: usize, ) -> Option<Box<dyn IntrospectItem<'s> + 's>>
fn introspect_len(&self) -> usize
source§impl<const C: usize> Introspect for ArrayString<C>
impl<const C: usize> Introspect for ArrayString<C>
fn introspect_value(&self) -> String
fn introspect_child(&self, _index: usize) -> Option<Box<dyn IntrospectItem<'_>>>
Implementors§
impl Introspect for Schema
Introspect is not implemented for Schema, though it could be