Skip to main content

FrameView

Struct FrameView 

Source
pub struct FrameView<'a> {
    pub simbox: Option<&'a SimBox>,
    pub meta: &'a HashMap<String, String>,
    /* private fields */
}
Expand description

A borrowed, read-only view of a Frame.

Block keys are &str references into the original Frame’s key strings. Block values are BlockViews that borrow the underlying column data. simbox and meta are borrowed by reference.

Fields§

§simbox: Option<&'a SimBox>

Borrowed simulation box, if present.

§meta: &'a HashMap<String, String>

Borrowed metadata map.

Implementations§

Source§

impl<'a> FrameView<'a>

Source

pub fn from_parts( map: HashMap<&'a str, BlockView<'a>>, simbox: Option<&'a SimBox>, meta: &'a HashMap<String, String>, ) -> FrameView<'a>

Construct a FrameView from parts.

Source

pub fn get(&self, key: &str) -> Option<&BlockView<'a>>

Gets an immutable reference to the block view for key if present.

Source

pub fn iter(&self) -> impl Iterator<Item = (&&'a str, &BlockView<'a>)>

Returns an iterator over (&str, &BlockView).

Source

pub fn keys(&self) -> impl Iterator<Item = &&'a str>

Returns an iterator over block keys.

Source

pub fn values(&self) -> impl Iterator<Item = &BlockView<'a>>

Returns an iterator over block view references.

Source

pub fn len(&self) -> usize

Number of blocks in the view.

Source

pub fn is_empty(&self) -> bool

Returns true if the view contains no blocks.

Source

pub fn contains_key(&self, key: &str) -> bool

Returns true if the view contains the specified block key.

Source

pub fn to_owned(&self) -> Frame

Creates an owned Frame by cloning all viewed data.

Trait Implementations§

Source§

impl Debug for FrameView<'_>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl FrameAccess for FrameView<'_>

Source§

fn get_float( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&f64>, Dim<IxDynImpl>>>

Gets a float array view from a column inside a block.
Source§

fn get_int( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&i32>, Dim<IxDynImpl>>>

Gets an int array view from a column inside a block.
Source§

fn get_bool( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&bool>, Dim<IxDynImpl>>>

Gets a bool array view from a column inside a block.
Source§

fn get_uint( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&u32>, Dim<IxDynImpl>>>

Gets a uint array view from a column inside a block.
Source§

fn get_u8( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&u8>, Dim<IxDynImpl>>>

Gets a u8 array view from a column inside a block.
Source§

fn get_string( &self, block_key: &str, col_key: &str, ) -> Option<ArrayBase<ViewRepr<&String>, Dim<IxDynImpl>>>

Gets a string array view from a column inside a block.
Source§

fn simbox_ref(&self) -> Option<&SimBox>

Returns a reference to the simulation box, if present.
Source§

fn meta_ref(&self) -> &HashMap<String, String>

Returns a reference to the metadata map.
Source§

fn block_keys(&self) -> Vec<&str>

Returns block keys as a Vec.
Source§

fn contains_block(&self, key: &str) -> bool

Returns true if the frame contains the specified block key.
Source§

fn block_count(&self) -> usize

Number of blocks.
Source§

fn is_empty(&self) -> bool

Returns true if the frame contains no blocks.
Source§

fn visit_block<R>( &self, key: &str, f: impl FnOnce(&dyn BlockAccess) -> R, ) -> Option<R>

Visits a block by key through the BlockAccess trait, using the visitor pattern to avoid lifetime/return-type issues. Returns None if the block does not exist.
Source§

impl<'a> From<&'a Frame> for FrameView<'a>

Source§

fn from(frame: &'a Frame) -> FrameView<'a>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for FrameView<'a>

§

impl<'a> RefUnwindSafe for FrameView<'a>

§

impl<'a> Send for FrameView<'a>

§

impl<'a> Sync for FrameView<'a>

§

impl<'a> Unpin for FrameView<'a>

§

impl<'a> UnsafeUnpin for FrameView<'a>

§

impl<'a> UnwindSafe for FrameView<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.