Type

Trait Type 

Source
pub trait Type: Sealed { }
Expand description

Data types that can be stored in chunk arrays.

GSD files store arrays of data of one of the following types:

The Type trait facilitates the generic methods including GsdFile::iter_scalars, GsdFile::write_scalars, and others. When needed, pass the type explicitly to these methods to read or write data chunks of the given type. In some cases, the Rust compiler may be able to determine the type from context.

§Example

use hoomd_gsd::file_layer::GsdFile;
let mut gsd_file = GsdFile::create_new(path, "example", "hoomd", (1, 4))?;
gsd_file.write_scalars(
    "configuration/box",
    [10.0_f32, 20.0, 15.0, 0.0, 0.0, 0.0],
)?;
gsd_file.end_frame()?;
gsd_file.sync_all()?;

let box_iter = gsd_file.iter_scalars::<f32>(0, "configuration/box")?;
itertools::assert_equal(box_iter, [10.0, 20.0, 15.0, 0.0, 0.0, 0.0]);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Type for f32

Source§

impl Type for f64

Source§

impl Type for i8

Source§

impl Type for i16

Source§

impl Type for i32

Source§

impl Type for i64

Source§

impl Type for u8

Source§

impl Type for u16

Source§

impl Type for u32

Source§

impl Type for u64

Implementors§