Skip to main content

extract_linear

Function extract_linear 

Source
pub fn extract_linear<'a>(
    arena: &'a ExprArena,
    id: ExprId,
) -> Option<LinearTerms<'a>>
Expand description

Extract the linear terms of id, if any. Used by solver backends to extract LP coefficients without walking the tree themselves.

The result borrows coefficients for a direct ExprNode::Linear and owns coefficients synthesized from a larger expression tree. Its lifetime is tied to arena in either case; call LinearTerms::into_owned to retain a snapshot independently of the arena.

Parameters are folded to their current arena values, so the returned terms reflect the latest ExprArena::set_param_value binding.