Skip to main content

map_with_context

Function map_with_context 

Source
pub fn map_with_context<Extra, V: GraphValue>(
    _classifier: &GraphClassifier<Extra, V>,
    f: impl Fn(&GraphQuery<V>, Pattern<V>) -> Pattern<V>,
    view: GraphView<Extra, V>,
) -> GraphView<Extra, V>
Expand description

Map elements in the view using the view’s query as context.

The mapping function f receives a reference to the view’s GraphQuery (a snapshot taken before any transformation) and the element pattern by value. All elements see the same snapshot — the query is not updated as elements are transformed.

The view is consumed; the returned view has the same query (cloned from the snapshot) and transformed elements.