ABI types
These are the types that cross the interface, and they are the same declarations a C program
sees: c/fznso_types.h is generated from this crate by cbindgen, so FznsoModelMethods here and
FznsoModelMethods in the header are one thing described once.
Read Types & values for what they mean, and Lifetimes & ownership for the rules that govern all of them.
33 types
Structs
Section titled “Structs”FznsoAnnotation
Section titled “FznsoAnnotation”struct FznsoAnnotationsourceThe handle of an annotation on a decision, constraint or objective.
Opaque: only the side that created it may interpret it. Read it through
FznsoAnnotationRef, which pairs it with the callbacks that can.
FznsoAnnotationMethods
Section titled “FznsoAnnotationMethods”struct FznsoAnnotationMethodssourceThe callbacks that read a FznsoAnnotation.
ident: extern "C" fn(ann: FznsoPtr<'_, FznsoAnnotation>) -> FznsoStr<'_>Retrieve the identifier of an annotation.
The returned string can be assumed to have the same lifetime as the annotation reference and must be valid UTF8.
argument_len: extern "C" fn(ann: FznsoPtr<'_, FznsoAnnotation>) -> usizeRetrieve the number of arguments of an annotation.
argument: extern "C" fn(ann: FznsoPtr<'_, FznsoAnnotation>, index: usize) -> FznsoValueRef<'_>Retrieve the value of the annotation’s argument at the given index.
The index argument must be less than the value returned by
annotation_argument_len for the given annotation.
FznsoAnnotationRef
Section titled “FznsoAnnotationRef”struct FznsoAnnotationRef<'a>sourceAn annotation together with the callbacks that read it.
data: FznsoPtr<'a, FznsoAnnotation>The data pointer of the annotation.
methods: &'static FznsoAnnotationMethodsReference to the structure containing the function callbacks used to interact with the annotation.
fn argument(&self, index: usize) -> FznsoValueRef<'a>The index-th argument of this annotation.
fn argument_len(&self) -> usizeNumber of arguments this annotation carries.
fn arguments(&self) -> impl Iterator + 'aIterator over all arguments of this annotation.
fn ident(&self) -> &'a strThe annotation’s identifier string (e.g. "output_var").
FznsoConstraintIdx
Section titled “FznsoConstraintIdx”struct FznsoConstraintIdxsourceWrapper type for the indexes that represent constraints in the model.
FznsoConstraintList
Section titled “FznsoConstraintList”struct FznsoConstraintList<'a>sourceA list of FznsoConstraintTypes.
This type is for example used to return from fznso_<name>_constraint_list.
len: usizeThe number of elements in the constraints array.
constraints: *const FznsoConstraintType<'a>An array of constraint types.
lifetime: std::marker::PhantomData<&'a ()>The lifetime for which the constraints attribute is allocated.
const fn empty() -> SelfReturns an empty list with no constraint types.
FznsoConstraintType
Section titled “FznsoConstraintType”struct FznsoConstraintType<'a>sourceRepresentation of a type of constraint, discerned by its identifier and the types of its arguments.
ident: FznsoStr<'a>The identifier of the constraint type.
arg_len: usizeThe number of expected arguments for the constraint type.
arg_types: *const FznsoTypeThe types of the expected arguments for the constraint type.
lifetime: std::marker::PhantomData<&'a ()>The lifetime for which the ident and arg_types attributes are
allocated.
FznsoDecisionIdx
Section titled “FznsoDecisionIdx”struct FznsoDecisionIdxsourceWrapper type for the indexes that represent decision variables in the model.
FznsoFloatRange
Section titled “FznsoFloatRange”struct FznsoFloatRangesourceAn inclusive [min, max] float range, returned by
FznsoValueMethods::get_range_float.
min: f64The inclusive lower bound.
max: f64The inclusive upper bound.
FznsoIntRange
Section titled “FznsoIntRange”struct FznsoIntRangesourceAn inclusive [min, max] integer range, returned by
FznsoValueMethods::get_range_int.
min: i64The inclusive lower bound.
max: i64The inclusive upper bound.
FznsoModel
Section titled “FznsoModel”struct FznsoModelsourceThe handle of a model instance.
Opaque: only the side that created it may interpret it. Read it through
FznsoModelRef, which pairs it with the callbacks that can.
FznsoModelMethods
Section titled “FznsoModelMethods”struct FznsoModelMethodssourceThe callbacks that read a FznsoModel.
Every index argument has a matching length callback, and must be below it. Everything these return (e.g. values, strings, and annotations) borrows from the model, and so is valid for as long as the model handle itself.
layer_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeReturns the current number of model layers currently contained in the model.
Layers are how an application adds and retracts groups of decision
variables and constraints between runs; see Self::layer_permanent
for the ones that can never be retracted.
layer_unchanged: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeReturns the number of layers that have been unchanged since the last
call to fznso_<name>_solver_run.
Unchanged layers must be consecutive starting from layer 0.
layer_permanent: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeReturns the number of permanent layers in the model.
Permanent layers are consecutive, starting from layer 0, and can never be retracted, so a solver may assume their number only ever grows.
Permanent layers can, however, still be found to be redundant, allowing
the solver to remove the decision variables and constraints in these
layers, if convenient. This is signaled using
Self::layer_redundant_len and Self::layer_redundant_index.
layer_redundant_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeReturns the number of permanent layers that have been marked as redundant.
The solver can remove the decision variables and constraints in these layers, if convenient. Once a layer is marked as redundant, it can forever be considered redundant. As such, the solver can assume that the number of redundant layers only ever increases.
layer_redundant_index: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, n: usize) -> usizeReturns the index of the n-th permanent layer that has been marked as redundant.
The n argument must be less than the value returned by
Self::layer_redundant_len.
decision_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeRetrieve the number of decisions currently contained in the model.
decision_layer_end: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, layer: usize) -> usizeRetrieve the exclusive upper bound on the decision indexes belonging to
layers 0..=layer.
Layer layer therefore owns the decisions
decision_layer_end(layer-1)..decision_layer_end(layer), taking the
bound below layer 0 to be 0. It equals decision_layer_end(layer-1)
when the layer adds no decisions, and Self::decision_len for the
last layer.
decision_type: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> FznsoTypeRetrieve the type of the given decision variable.
This is what the type of value the decision must take, as opposed to
Self::decision_domain, which says which specific values it may take.
decision_domain: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> FznsoValueRef<'_>Retrieve the domain of the given decision.
Note that the value might have FznsoValueKind::FznsoValueAbsent
if the decision variable does not have an explicit domain.
decision_name: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> FznsoStr<'_>Retrieve the name of a decision variable, if it exists.
Note that names are only available for debugging purposes. Decisions are
identified using their index in the model. If the decision variable does
not have a name, the returned string has a null ptr.
decision_defined: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> boolCheck whether the decision variable is defined by a constraint.
decision_in_solution: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> boolCheck whether the application may ask a solution for this decision variable’s value.
A solver must give every such variable a value in every solution it reports, and is free to leave the others open.
decision_annotation_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx) -> usizeRetrieve the number of annotations on a decision variable.
decision_annotation: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, decision: FznsoDecisionIdx, index: usize) -> FznsoAnnotationRef<'_>Retrieve the annotation on a decision variable at the given index.
Requires index to be less than Self::decision_annotation_len for
that decision variable.
constraint_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeRetrieve the number of constraints currently contained in the model.
constraint_layer_end: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, layer: usize) -> usizeRetrieve the exclusive upper bound on the constraint indexes belonging
to layers 0..=layer.
Layer layer therefore owns the constraints
constraint_layer_end(layer-1)..constraint_layer_end(layer), taking
the bound below layer 0 to be 0. It equals
constraint_layer_end(layer-1) when the layer adds no constraints, and
Self::constraint_len for the last layer.
constraint_ident: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx) -> FznsoStr<'_>Retrieve the identifier of a constraint.
The returned string can be assumed to have the same lifetime as the model reference and must be valid UTF8.
constraint_argument_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx) -> usizeRetrieve the number of arguments of a constraint.
constraint_argument: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx, index: usize) -> FznsoValueRef<'_>Retrieve the value of the constraint’s argument at the given index.
The index argument must be less than the value returned by
constraint_argument_len for the given constraint.
constraint_defines: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx) -> FznsoValueRef<'_>Check whether the decision variable is functionally defined by a constraint.
This function returns a FznsoValue that is either
FznsoValueKind::FznsoValueDecision if it defined a decision variable
or FznsoValueKind::FznsoValueAbsent otherwise.
constraint_annotation_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx) -> usizeRetrieve the number of annotations on a constraint.
constraint_annotation: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, constraint: FznsoConstraintIdx, index: usize) -> FznsoAnnotationRef<'_>Retrieve the annotation on a constraint at the given index.
The index argument must be less than the value returned by
constraint_annotation_len for the given constraint.
objective_ident: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> FznsoStr<'_>Request the identifier of the type of objective strategy to be used when solving the model.
Note that the returned string has a null ptr if the model does not
have an objective strategy.
objective_arg: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> FznsoValueRef<'_>Retrieve the argument of the objective strategy.
objective_annotation_len: extern "C" fn(model: FznsoPtr<'_, FznsoModel>) -> usizeRetrieve the number of annotations on an objective
objective_annotation: extern "C" fn(model: FznsoPtr<'_, FznsoModel>, index: usize) -> FznsoAnnotationRef<'_>Retrieve the annotation on the objective at the given index.
The index argument must be less than the value returned by
objective_annotation_len.
FznsoModelRef
Section titled “FznsoModelRef”struct FznsoModelRef<'a>sourceA model together with the callbacks that read it.
data: FznsoPtr<'a, FznsoModel>The handle to the data of the model instance.
methods: &'static FznsoModelMethodsReference to the structure containing the function callbacks used to interact with the model.
FznsoObjective
Section titled “FznsoObjective”struct FznsoObjective<'a>sourceRepresentation of a type of objective strategies, discerned by its identifier and the type of its argument.
ident: FznsoStr<'a>The identifier of the objective type.
arg_type: FznsoTypeThe type of the expected argument for the constraint type.
lifetime: std::marker::PhantomData<&'a ()>The lifetime for which the ident attribute is allocated.
FznsoObjectiveList
Section titled “FznsoObjectiveList”struct FznsoObjectiveList<'a>sourceA list of FznsoObjectives.
This type is, for example, used to return from
fznso_<name>_objective_list.
len: usizeThe number of elements in the objectives array.
objectives: *const FznsoObjective<'a>An array of objective strategies.
lifetime: std::marker::PhantomData<&'a ()>The lifetime of the options attribute.
const fn empty() -> SelfReturns an empty list with no objective types.
FznsoOption
Section titled “FznsoOption”struct FznsoOption<'a>sourceThe definition of an option that is available to be set for the solver.
ident: FznsoStr<'a>The identifier used to set the option or get the current value of the option.
arg_ty: FznsoTypeThe type of value that is expected for this option.
arg_def: FznsoValueRef<'a>The default value for this option.
lifetime: std::marker::PhantomData<&'a ()>The lifetime of the ident and arg_def attributes.
FznsoOptionList
Section titled “FznsoOptionList”struct FznsoOptionList<'a>sourceA list of FznsoOptions.
This type is, for example, used to return from fznso_<name>_option_list.
len: usizeThe number of elements in the options array.
options: *const FznsoOption<'a>An array of option definitions.
lifetime: std::marker::PhantomData<&'a ()>The lifetime of the options attribute.
const fn empty() -> SelfReturns an empty list with no options.
FznsoPtr
Section titled “FznsoPtr”struct FznsoPtr<'a, T>sourceA pointer to an FZnSO handle, tagged with the lifetime for which the handle stays valid.
This is deliberately a raw pointer rather than a Rust reference, because the interface relies on two things a reference cannot do:
- Casting back to the implementation’s own type. A handle is produced by
casting e.g.
*const MyModelto*const FznsoModel, and the callbacks cast it back before use. A&FznsoModelwould only carry permission to access the opaque handle type itself, so reading the larger original type through it is undefined behaviour. - Encoding a value directly in the pointer word. Small values such as a
FznsoDecisionIdxare stored in the pointer rather than behind it, so that handing one across the interface never requires an allocation. SeeFznsoPtr::from_addr.
The 'a lifetime costs nothing at runtime. It exists so that callback
signatures state how long the handle — and anything derived from it —
remains valid, which is what lets the return types of
FznsoModelMethods and friends borrow from their argument.
cbindgen:no-export
ptr: *const TThe pointer to the handle, or a value encoded in the pointer word.
lifetime: std::marker::PhantomData<&'a T>The lifetime for which ptr stays valid.
fn addr(self) -> usizeRead back a payload stored with FznsoPtr::from_addr.
const fn cast<U>(self) -> *const UReinterpret this handle as a pointer to U.
This is the inverse of FznsoPtr::from_ref. Dereferencing the result
is only sound if U is the type the handle was originally built from.
const fn from_addr(addr: usize) -> SelfStore a plain integer payload directly in the pointer word.
The result carries no provenance and must never be dereferenced; only
FznsoPtr::addr may read it back. This is how small values cross the
interface without an allocation.
const fn from_ref<S>(value: &'a S) -> SelfWrap a reference to the implementation’s own type as an opaque handle.
The handle keeps permission to access the whole of S, so the callbacks
may cast it back with FznsoPtr::cast.
const fn new(ptr: *const T) -> SelfWrap a raw pointer that already points at the handle’s contents.
FznsoSolution
Section titled “FznsoSolution”struct FznsoSolutionsourceThe handle of a solution reported by a solver.
Opaque: only the side that created it may interpret it. Read it through
FznsoSolutionRef, which pairs it with the callbacks that can.
FznsoSolutionMethods
Section titled “FznsoSolutionMethods”struct FznsoSolutionMethodssourceThe callbacks that read a FznsoSolution.
The values these return borrow from the solution, so they last only as long
as it does (i.e. for the duration of the on_solution callback that
delivered it). Copy out anything that has to outlive the call.
value: extern "C" fn(data: FznsoPtr<'_, FznsoSolution>, decision_index: usize) -> FznsoValueRef<'_>Function callback to retrieve the value assigned to a decision variable in the solution.
statistic: extern "C" fn(data: FznsoPtr<'a, FznsoSolution>, ident: FznsoStr<'i>) -> FznsoValueRef<'a>Function callback to retrieve the statistical information made available by the solver about the search process so far.
FznsoSolutionRef
Section titled “FznsoSolutionRef”struct FznsoSolutionRef<'a>sourceA solution together with the callbacks that read it.
data: FznsoPtr<'a, FznsoSolution>The data pointer to be used as the first argument in the function
callbacks provided by the methods field.
methods: &'static FznsoSolutionMethodsReference to the structure containing the function callbacks used to interact with the solution.
FznsoSolver
Section titled “FznsoSolver”struct FznsoSolversourceThe handle of a solver instance, as returned by fznso_solver_create.
Opaque: only the solver library may interpret it. An application passes it
back to the library’s entry points and releases it with
fznso_solver_free.
FznsoStatistic
Section titled “FznsoStatistic”struct FznsoStatistic<'a>sourceThe definition of statistical information that is made available by the solver.
The solution and solver flags say where the statistic can be read
from, and are independent: a statistic may be available from a solution,
from the solver instance, or from both. At least one of them must be set —
a statistic with neither could be read from nowhere.
ident: FznsoStr<'a>The identifier used to retrieve the statistical information from the solver or a solution.
ty: FznsoTypeThe type of value that is expected for this statistic.
solution: boolWhether the statistic is available from a solution, read with
FznsoSolutionMethods::statistic.
solver: boolWhether the statistic is available from the solver instance, read with
fznso_solver_statistic.
lifetime: std::marker::PhantomData<&'a ()>The lifetime of the ident attribute.
FznsoStatisticList
Section titled “FznsoStatisticList”struct FznsoStatisticList<'a>sourceA list of FznsoStatistics.
This type is, for example, used to return from
fznso_<name>_statistic_list.
len: usizeThe number of elements in the stats array.
stats: *const FznsoStatistic<'a>An array of statistic definitions.
lifetime: std::marker::PhantomData<&'a ()>The lifetime of the stats attribute.
const fn empty() -> SelfReturns an empty list with no statistics.
FznsoStr
Section titled “FznsoStr”struct FznsoStr<'a>sourceA borrowed UTF-8 string, passed across the interface as a pointer/length pair.
The bytes are not required to be null-terminated; consumers must use
len to determine the string extent. This matches the convention used by
FznsoValueMethods::as_string, and allows implementations to hand out
slices of strings they already hold without copying them into a
null-terminated buffer.
A null ptr signals the absence of a string, which is used where a name or
identifier is optional (e.g. FznsoModelMethods::decision_name).
ptr: *const ffi::c_charPointer to the first UTF-8 byte of the string, or null if absent.
len: usizeThe number of bytes in the string, not counting any trailing null byte.
lifetime: std::marker::PhantomData<&'a ()>The lifetime for which ptr stays valid.
unsafe fn as_str(self) -> Option<&'a str>Interpret this string as a &str, or None if ptr is null.
Safety
Section titled “Safety”ptr must point to len bytes of valid UTF-8 that stay live for 'a.
const fn new(value: &'a str) -> SelfBorrow a &str as an interface string.
Usable in const context, so that the capability lists a solver declares
— which are static — can name their identifiers directly.
FznsoType
Section titled “FznsoType”struct FznsoTypesourceRepresentation of a type to signal and check whether an argument takes the correct type.
list_of: boolWhether the type is a list of values.
decision: boolWhether the argument can be or contain decision variables (represented as decision indexes).
set_of: boolWhether expected type is an set of values of the base type.
opt: boolWhether the expected type is optional (and can take the value of
FznsoValueKind::FznsoValueAbsent).
base: FznsoTypeBaseThe expected base type of the argument.
const fn decision(self, decision: bool) -> SelfWhether this type is a decision variable rather than a parameter.
const fn list(self, list_of: bool) -> SelfWhether this type is a list of its element type.
const fn new(base: FznsoTypeBase) -> SelfA plain parameter type of the given base: not a list, not a set, not a decision variable and not optional.
Each qualifier is a builder method taking the value to give it, so a type only ever carries the flags it was actually told about, and a flag that depends on something can be passed straight through:
# use fznso_types::{FznsoType, FznsoTypeBase};// `list of var int`let arg = FznsoType::new(FznsoTypeBase::FznsoTypeBaseInt) .list(true) .decision(true);// `var set of int`, or plain `var int`, depending on `of_sets`let of_sets = true;let var = FznsoType::new(FznsoTypeBase::FznsoTypeBaseInt) .decision(true) .set(of_sets);const fn opt(self, opt: bool) -> SelfWhether this type also permits the absent value.
const fn set(self, set_of: bool) -> SelfWhether this type is over sets of its base type rather than single values.
FznsoTypeList
Section titled “FznsoTypeList”struct FznsoTypeList<'a>sourceA list of FznsoTypes.
This type is for example used to return from fznso_<name>_decision_list.
len: usizeThe number of elements in the types array.
types: *const FznsoTypeAn array of decision-variable types.
lifetime: std::marker::PhantomData<&'a ()>The lifetime for which the types attribute is allocated.
const fn empty() -> SelfReturns an empty list with no decision types.
FznsoValue
Section titled “FznsoValue”struct FznsoValuesourceThe handle of a value: a constraint argument, a variable domain, a solution assignment, an option or a statistic.
Opaque: only the side that created it may interpret it. Read it through
FznsoValueRef, which pairs it with the callbacks that can.
This is the handle least likely to be a pointer at all: a small payload such
as a decision index is normally stored in the pointer word rather than
behind it, and the absent value carries a null. Dispatch on
FznsoValueMethods::kind and use the accessor it permits; never
dereference the handle itself.
FznsoValueMethods
Section titled “FznsoValueMethods”struct FznsoValueMethodssourceThe callbacks that read a FznsoValue.
FznsoValueMethods::kind decides which of the others are meaningful; each
states the precondition it needs. A nested value or string that these return
borrows from the value it came from.
kind: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> FznsoValueKindFunction callback that returns the kind of the value.
len: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> usizeFunction callback that returns the length of the value.
In case FznsoValueMethods::kind returns
FznsoValueKind::FznsoValueString, the length is the number of bytes
in the string not counting any trailing null byte. The pointer
returned by FznsoValueMethods::as_string is not required to be null-
terminated; callers must use this length to determine the string extent.
In case FznsoValueMethods::kind returns
FznsoValueKind::FznsoValueList, the length is the number of elements
in the list, accessible using FznsoValueMethods::get_element.
In case FznsoValueMethods::kind returns
FznsoValueKind::FznsoValueSetInt or
FznsoValueKind::FznsoValueSetFloat, the length is the number of
ranges in the set, accessible using
FznsoValueMethods::get_range_int or
FznsoValueMethods::get_range_float.
Requires FznsoValueMethods::kind to return one of
FznsoValueKind::FznsoValueString,
FznsoValueKind::FznsoValueList,
FznsoValueKind::FznsoValueSetInt, or
FznsoValueKind::FznsoValueSetFloat.
as_decision: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> FznsoDecisionIdxFunction callback that returns the decision variable index contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueDecision.
as_constraint: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> FznsoConstraintIdxFunction callback that returns the constraint index contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueConstraint.
as_int: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> i64Function callback that returns the integer value contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueInt.
as_float: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> f64Function callback that returns the floating point value contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueFloat.
as_string: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> *const ffi::c_charFunction callback that returns a pointer to the UTF-8 bytes of a string
value. The pointer is valid for FznsoValueMethods::len bytes and is
not required to be null-terminated (a trailing null byte may or may
not be present).
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueString.
as_bool: extern "C" fn(FznsoPtr<'_, FznsoValue>) -> boolFunction callback that returns the Boolean value contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueBool.
get_range_int: extern "C" fn(FznsoPtr<'_, FznsoValue>, index: usize) -> FznsoIntRangeFunction callback that returns a range from a range list representing the integer set contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueSetInt, and index to be below
FznsoValueMethods::len.
get_range_float: extern "C" fn(FznsoPtr<'_, FznsoValue>, index: usize) -> FznsoFloatRangeFunction callback that returns a range from a range list representing the floating point set contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueSetFloat, and index to be below
FznsoValueMethods::len.
get_element: extern "C" fn(FznsoPtr<'_, FznsoValue>, index: usize) -> FznsoValueRef<'_>Function callback that returns an element from the list contained in the value.
Requires FznsoValueMethods::kind to return
FznsoValueKind::FznsoValueList, and index to be below
FznsoValueMethods::len.
FznsoValueRef
Section titled “FznsoValueRef”struct FznsoValueRef<'a>sourceA value together with the callbacks that read it.
data: FznsoPtr<'a, FznsoValue>The data pointer to be the first argument of get_value.
methods: &'static FznsoValueMethodsReference to the structure containing the function callbacks used to interact with the value.
fn get_bool(&self) -> boolRust call to FznsoValueMethods::as_bool with the
FznsoValueRef::data attribute.
fn get_constraint(&self) -> FznsoConstraintIdxRust call to FznsoValueMethods::as_constraint with the
FznsoValueRef::data attribute.
fn get_decision(&self) -> FznsoDecisionIdxRust call to FznsoValueMethods::as_decision with the
FznsoValueRef::data attribute.
fn get_element(&self, idx: usize) -> FznsoValueRef<'a>Rust call to FznsoValueMethods::get_element with the
FznsoValueRef::data attribute.
fn get_float(&self) -> f64Rust call to FznsoValueMethods::as_float with the
FznsoValueRef::data attribute.
fn get_int(&self) -> i64Rust call to FznsoValueMethods::as_int with the
FznsoValueRef::data attribute.
fn get_range_float(&self, idx: usize) -> (f64, f64)Rust call to FznsoValueMethods::get_range_float with the
FznsoValueRef::data attribute.
fn get_range_int(&self, idx: usize) -> (i64, i64)Rust call to FznsoValueMethods::get_range_int with the
FznsoValueRef::data attribute.
fn get_string(&self) -> &'a strRust call to FznsoValueMethods::as_string and
FznsoValueMethods::len to obtain the string as a &str.
The returned slice is valid for the lifetime of the value. The underlying bytes are not required to be null-terminated.
fn is_empty(&self) -> boolWrapper for a call to FznsoValueMethods::len with the
FznsoValueRef::data attribute, returning true if the len is
zero.
fn kind(&self) -> FznsoValueKindRust call to FznsoValueMethods::kind with the
FznsoValueRef::data attribute.
fn len(&self) -> usizeRust call to FznsoValueMethods::len with the FznsoValueRef::data
attribute.
FznsoStatus
Section titled “FznsoStatus”enum FznsoStatussourceThe status returned by fznso_solver_run, indicating whether the solver
completed its search.
FznsoCompleteThe solver explored the full search space and yielded all relevant solutions.
FznsoIncompleteThe solver did not explore the full search space due to a timeout or other termination condition. Additional (better) solutions might be possible.
FznsoErrorAn error occurred during the solver’s execution.
fznso_<name>_solver_read_error can be used to retrieve the error
message.
FznsoTypeBase
Section titled “FznsoTypeBase”enum FznsoTypeBasesourceRepresentation of the base type of a value.
FznsoTypeBaseBoolBoolean type
FznsoTypeBaseIntInteger numeric type
FznsoTypeBaseFloatFloating point numeric type
FznsoTypeBaseStringCharacter string type
FznsoValueKind
Section titled “FznsoValueKind”enum FznsoValueKindsourceEnumerated type used to mark the kind of FznsoValue. This is used to
determine which “get” method in FznsoValueMethods is safe to call.
FznsoValueAbsentNo value is available.
FznsoValueDecisionThe value is available using FznsoValueMethods::as_decision.
FznsoValueConstraintThe value is available using FznsoValueMethods::as_constraint.
FznsoValueBoolThe value is available using FznsoValueMethods::as_bool.
FznsoValueIntThe value is available using FznsoValueMethods::as_int.
FznsoValueFloatThe value is available using FznsoValueMethods::as_float.
FznsoValueStringThe value is available using FznsoValueMethods::as_string.
FznsoValueSetIntSets of integers are represented using a range list. The number of
ranges is available using FznsoValueMethods::len, and the ranges can
be accessed using FznsoValueMethods::get_range_int.
FznsoValueSetFloatSets of floats are represented using a range list. The number of
ranges is available using FznsoValueMethods::len, and the ranges can
be accessed using FznsoValueMethods::get_range_float.
FznsoValueListThe length of the list can be accessed using
FznsoValueMethods::len, and elements in the list can be
accessed using FznsoValueMethods::get_element
Constants
Section titled “Constants”FZNSO_ABI_VERSION
Section titled “FZNSO_ABI_VERSION”const FZNSO_ABI_VERSION: u32sourceThe FZnSO ABI version this crate defines.
A solver exports it as fznso_<name>_abi_version, and a loader rejects any
solver whose reported version differs from its own.