mant-query 0.11.0

Bounded semantic queries over existing ManT document snapshots
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Borrowed source facts adapted to the transport-neutral label policy.
use mant_ir::EntryOwner;
use mant_protocol::{EntryLabelMode, entry_label};

pub(crate) fn owner_label(owner: EntryOwner<'_>, names: &[String], mode: EntryLabelMode) -> String {
    let id = owner.facts().expect("indexed entry label").id.as_str();
    // Avoid projecting styled forms for the common names-only label path.
    if mode == EntryLabelMode::Compact && !names.is_empty() {
        return entry_label(mode, id, names, std::iter::empty::<&str>());
    }
    let forms = owner.forms().unwrap_or_default();
    entry_label(
        mode,
        id,
        names,
        forms.iter().map(mant_ir::inline_plain_text),
    )
}