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.