SourceBundle

Struct SourceBundle 

Source
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

Source

pub fn new(bytes: Vec<u8>) -> Arc<Self>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn bytes(&self) -> &[u8] ⓘ

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.