Skip to main content

select

Function select 

Source
pub async fn select<FS: ReadStorage, Ix: IdIndex>(
    graph: &Graph<FS, Ix>,
    spec: &ViewSpec,
    root_doc: impl AsRef<Path>,
) -> Result<Selection>
Expand description

Select the documents spec covers, walking from root_doc.

root_doc is the workspace’s root document: the spanning start for a view that declares no anchor, and the document an under: link resolves relative to. It is deliberately not the config surface the view was declared in — a view is a property of the workspace, so moving the config document that carries it must not change what it points at.

A view whose anchor names nothing is an Error::AnchorUnresolved, not an empty result. Those two states look identical to a reader and mean opposite things: one is an archive with nothing in it yet, the other is a misconfigured lens, and swallowing the second is how a broken view gets read as an empty one for a year.