pub struct ExternalResolver {
pub funcs_by_id: HashMap<usize, (Arc<ExternalLibrary>, String)>,
}Expand description
Resolved AMPL imported function: shared library + registered name.
NlProblem carries one of these per ImportedFunc id when external
functions are wired up at problem-build time. The same Arc<ExternalLibrary>
may be shared across many funcall ids (one library typically registers
several functions).
Fields§
§funcs_by_id: HashMap<usize, (Arc<ExternalLibrary>, String)>Funcall { id } -> (library, registered function name).
Implementations§
Source§impl ExternalResolver
impl ExternalResolver
pub fn is_empty(&self) -> bool
Sourcepub fn build_for_problem(
imported_funcs: &[ImportedFunc],
referenced_ids: &BTreeSet<usize>,
) -> Result<Self, String>
pub fn build_for_problem( imported_funcs: &[ImportedFunc], referenced_ids: &BTreeSet<usize>, ) -> Result<Self, String>
Build a resolver for every ImportedFunc declared in the .nl file
that is actually referenced somewhere in the problem’s expressions.
Library paths are resolved through the AMPLFUNC environment variable
(a \n-separated list of shared-library paths, matching AMPL/IPOPT
conventions). Each path is loaded once and queried for every name we
need. Returns an error if a referenced name cannot be found in any
listed library, or if AMPLFUNC is missing.
Trait Implementations§
Source§impl Clone for ExternalResolver
impl Clone for ExternalResolver
Source§fn clone(&self) -> ExternalResolver
fn clone(&self) -> ExternalResolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ExternalResolver
impl Default for ExternalResolver
Source§fn default() -> ExternalResolver
fn default() -> ExternalResolver
Auto Trait Implementations§
impl Freeze for ExternalResolver
impl RefUnwindSafe for ExternalResolver
impl Send for ExternalResolver
impl Sync for ExternalResolver
impl Unpin for ExternalResolver
impl UnsafeUnpin for ExternalResolver
impl UnwindSafe for ExternalResolver
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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