#[non_exhaustive]pub struct IndexedDocument<'a> {
pub doc: &'a Document,
pub index: &'a DocIndex,
}Expand description
A document and the index over it, bundled so they cannot be mismatched.
The pairing is the guarantee. DocIndex::view is the only
constructor: it brings the index up to date against the very document
it then bundles, so consulting an index built from a different
document — the one hazard a derived index has, and the same mistake
class as reading the wrong document directly — is unrepresentable
rather than merely discouraged. Coherence beyond that is structural:
documents are immutable values, so a matched index cannot drift.
The refresh is gated on the document’s stamp, so re-viewing a document nothing has folded into costs one comparison; a rebuild happens only where a new document value does.
A pair of shared references, so the view copies freely — the pairing constructor is still the only way to make one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.doc: &'a Document§index: &'a DocIndexTrait Implementations§
Source§impl<'a> Clone for IndexedDocument<'a>
impl<'a> Clone for IndexedDocument<'a>
Source§fn clone(&self) -> IndexedDocument<'a>
fn clone(&self) -> IndexedDocument<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more