pub struct QueryTerm<R, T: Target> { /* private fields */ }Expand description
One query of an order space: the scheme’s query, labelled with the
target it was made under, as an OrderTerm is.
Under a marker from target the label is a
zero-sized type, so a query of one target, or of one null policy,
cannot meet a term of another in OrderSpace::compare_query: that
does not compile. Under an OrderTarget the label is stored, and a
query and a term of different targets or policies compare as None
instead of as noise.
A query is not a term: it has its own type, so it cannot be compared
where a term is expected, and the compiler refuses
space.compare(&query, &term). Its bytes are bytes, though, as a
term’s are: as_bytes and AsRef<[u8]> are there
so a caller can send the query to wherever the terms are, and nothing
stops a caller writing them into a term’s place. Under block ORE a
query has no right half, so every later compare against those bytes
returns None; under a scheme whose Query is its Term the mistake
is invisible.
== compares the bytes. Whether that is equality of the values
searched for depends on the scheme: under block ORE, whose queries are
deterministic, it is. A query is for the comparison at hand and should
not be persisted or logged, as OrderQuery explains, so Debug
shows the target and masks the query.