Skip to main content

StructDataExt

Trait StructDataExt 

Source
pub trait StructDataExt {
    // Required methods
    fn field(&self, name: &str) -> Option<&StructField>;
    fn value(&self, index: usize) -> Option<&Scalar>;
    fn index_of(&self, name: &str) -> Option<usize>;
}
Expand description

Extension trait for Kernel’s StructData.

StructData is the data structure contained in a Struct scalar. The exposed API on kernels struct data is very minimal and does not allow for conveniently probing the fields / values contained within StructData.

This trait therefore adds convenience methods for accessing fields and values.

Required Methods§

Source

fn field(&self, name: &str) -> Option<&StructField>

Returns a reference to the field with the given name, if it exists.

Source

fn value(&self, index: usize) -> Option<&Scalar>

Returns a reference to the value with the given index, if it exists.

Source

fn index_of(&self, name: &str) -> Option<usize>

Returns the index of the field with the given name, if it exists.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl StructDataExt for StructData

Source§

fn field(&self, name: &str) -> Option<&StructField>

Source§

fn index_of(&self, name: &str) -> Option<usize>

Source§

fn value(&self, index: usize) -> Option<&Scalar>

Implementors§