pub struct SourceBundle { /* private fields */ }Expand description
One immutable source load. Construction scans original bytes, never a UTF-8 rewrite. Cloning the Arc or making a decoder does not rescan or copy inputs.
Implementations§
Source§impl SourceBundle
impl SourceBundle
pub fn new(bytes: Vec<u8>) -> Arc<Self>
Sourcepub fn scan_with(
bytes: Arc<Vec<u8>>,
visit: impl FnMut(u32, &str, usize, usize),
) -> Arc<Self>
pub fn scan_with( bytes: Arc<Vec<u8>>, visit: impl FnMut(u32, &str, usize, usize), ) -> Arc<Self>
Fuse index construction with an existing canonical classification pass. The visitor sees canonical scanner records; it cannot supply index rows.
Sourcepub fn columnar(bytes: Arc<Vec<u8>>) -> Result<Arc<Self>, SpanBeyondU32>
pub fn columnar(bytes: Arc<Vec<u8>>) -> Result<Arc<Self>, SpanBeyondU32>
Build the compact browser representation directly with the existing canonical index builder, without building or validating a second index.
Sourcepub fn with_columnar_index(
bytes: Arc<Vec<u8>>,
index: Arc<ColumnarEntityIndex>,
) -> Result<Arc<Self>, SourceIndexMismatch>
pub fn with_columnar_index( bytes: Arc<Vec<u8>>, index: Arc<ColumnarEntityIndex>, ) -> Result<Arc<Self>, SourceIndexMismatch>
Validate a delivered compact index against the canonical byte scanner once at load. Exact spans and completeness are checked, including the canonical last-occurrence rule. Equal IDs or lengths alone prove nothing.
Sourcepub fn bind_decoder(self: &Arc<Self>, decoder: &mut EntityDecoder<'_>) -> bool
pub fn bind_decoder(self: &Arc<Self>, decoder: &mut EntityDecoder<'_>) -> bool
Adopt a pristine decoder over the exact owned allocation. Populated or externally seeded decoders cannot acquire factory authority. Prewarm a factory decoder instead, then move its opaque source caches.
Sourcepub fn install_compatibility_index(&self, decoder: &mut EntityDecoder<'_>)
pub fn install_compatibility_index(&self, decoder: &mut EntityDecoder<'_>)
Install this bundle’s existing index under the borrowed compatibility
contract: the caller must pair the decoder with these source bytes.
Retains populated decoded caches and refusal state, without granting
factory provenance. Use decoder() for fresh authenticated workers.
pub fn bytes(&self) -> &[u8] ⓘ
Sourcepub fn decoder(self: &Arc<Self>) -> EntityDecoder<'_>
pub fn decoder(self: &Arc<Self>) -> EntityDecoder<'_>
A fresh mutable decoder retains the actual paired allocation. It can move to a scoped worker. The context retains the bundle after its caller drops the original handle; borrowing that snapshot needs no input copy.
Sourcepub fn owns_decoder(self: &Arc<Self>, decoder: &EntityDecoder<'_>) -> bool
pub fn owns_decoder(self: &Arc<Self>, decoder: &EntityDecoder<'_>) -> bool
This compares private factory provenance, not caller-asserted identity, length, IDs or an arbitrary prebuilt index’s allocation address.