pub struct DataFile<Int> { /* private fields */ }Expand description
The top-level structure which represents a data file.
A data file is a key-value store, where the key is a MiniZinc identifier, and the value is one of:
intboolarray ofone of the above
Conceptually, the integers in the MiniZinc specification are unbounded, which means the scalar
signed integers not model the DZN integers well. However, from a practical standpoint, many
uses of DZN files do only deal with i32 or others. Therefore, DataFile is generic over
the integer type to allow the user to decide how big the integers can be.
Implementations§
Source§impl<Int: Integer> DataFile<Int>
impl<Int: Integer> DataFile<Int>
Sourcepub fn get<T>(&self, key: &str) -> Option<&T>
pub fn get<T>(&self, key: &str) -> Option<&T>
Get a value from the data file with the given key.
When attempting to get a specific type, this method does not discriminate to the key not
existing at all, or whether the value is a different type. In either situation, None is
returned.
Sourcepub fn array_1d<T>(
&self,
key: &str,
length: usize,
) -> Option<&ShapedArray<T, 1>>
pub fn array_1d<T>( &self, key: &str, length: usize, ) -> Option<&ShapedArray<T, 1>>
Get a 1-dimensional array from the data file with the given key and length.