pub struct WriteOptions {
pub format: NlFormat,
pub precision: Option<u32>,
pub comments: bool,
pub nonfinite_strings: bool,
pub aux_files: bool,
pub functions: Vec<ImportedFunction>,
pub suffixes: Vec<SuffixData>,
pub defined_vars: Vec<DefinedVar>,
pub dual_init: Vec<(u32, f64)>,
pub complementarity: Vec<(usize, Complementarity)>,
}Expand description
Options for the writer.
Default::default() matches the writer’s original behaviour: ASCII output
with trailing \t# ... comments, shortest-round-trip numeric formatting,
and an error on NaN/Inf constants.
Fields§
§format: NlFormat§precision: Option<u32>None -> shortest round-trip (default Rust {} for f64).
Some(n) -> n significant digits in scientific notation ({:.*e},
e.g. 3.142e0).
comments: boolEmit trailing \t# ... comments in the header and segment introducers
(ASCII format only). Ignored in binary mode.
nonfinite_strings: boolWhen true, NaN/Inf numeric constants are emitted as Infinity /
-Infinity / NaN strings (matching AMPL NL_LIB_GFMT). When false
(default) the writer fails with IoError::InvalidNumber.
aux_files: boolWhen true, a write_nl_files call also emits the sibling
<stub>.row (constraint names) and <stub>.col (variable names) files
next to the .nl, and populates the header’s max_name_len fields.
functions: Vec<ImportedFunction>Imported function declarations (F segments). Empty by default.
suffixes: Vec<SuffixData>Suffix entries (S segments). Empty by default.
defined_vars: Vec<DefinedVar>Defined variables (V segments). Empty by default.
dual_init: Vec<(u32, f64)>Dual seeds (d segment), sparse (constraint_nl_index, value) pairs.
complementarity: Vec<(usize, Complementarity)>Complementarity entries for the r segment. Maps a constraint index
to its complementarity info. Empty by default.
Implementations§
Source§impl WriteOptions
impl WriteOptions
Trait Implementations§
Source§impl Clone for WriteOptions
impl Clone for WriteOptions
Source§fn clone(&self) -> WriteOptions
fn clone(&self) -> WriteOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WriteOptions
impl Debug for WriteOptions
Auto Trait Implementations§
impl Freeze for WriteOptions
impl RefUnwindSafe for WriteOptions
impl Send for WriteOptions
impl Sync for WriteOptions
impl Unpin for WriteOptions
impl UnsafeUnpin for WriteOptions
impl UnwindSafe for WriteOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more