DcSource

Trait DcSource 

Source
pub trait DcSource {
    type Owned;

    // Required methods
    fn source_bytes(&self) -> &[u8] ⓘ;
    fn replace_typed_source_field_with_policy_and_resolver(
        &self,
        range: Range<usize>,
        fragment: &DcMstr,
        policy: &DcProjectionPolicy,
        resolver: &dyn SyntaxRuleResolver,
    ) -> Result<Self::Owned>;
    fn replace_source_field(
        &self,
        range: Range<usize>,
        fragment: &DcMstr,
    ) -> Result<Self::Owned>;

    // Provided methods
    fn replace_typed_source_field(
        &self,
        range: Range<usize>,
        fragment: &DcMstr,
    ) -> Result<Self::Owned> { ... }
    fn replace_typed_source_field_with_resolver(
        &self,
        range: Range<usize>,
        fragment: &DcMstr,
        resolver: &dyn SyntaxRuleResolver,
    ) -> Result<Self::Owned> { ... }
}
Expand description

Source representations supporting byte-preserving structured replacement.

Required Associated Types§

Source

type Owned

The corresponding owned string representation.

Required Methods§

Source

fn source_bytes(&self) -> &[u8] ⓘ

Returns the original encoded string, including its format header.

Source

fn replace_typed_source_field_with_policy_and_resolver( &self, range: Range<usize>, fragment: &DcMstr, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<Self::Owned>

Reconciles a typed replacement with its original source representation using policy and resolver.

§Errors

Returns an error for invalid ranges or ambiguous source correspondence.

Source

fn replace_source_field( &self, range: Range<usize>, fragment: &DcMstr, ) -> Result<Self::Owned>

Splices an encoded field after checking source and fragment boundaries.

§Errors

Returns an error for invalid ranges or ranges splitting encapsulations.

Provided Methods§

Source

fn replace_typed_source_field( &self, range: Range<usize>, fragment: &DcMstr, ) -> Result<Self::Owned>

Reconciles a typed replacement with its original source representation.

§Errors

Returns an error for invalid ranges or ambiguous source correspondence.

Source

fn replace_typed_source_field_with_resolver( &self, range: Range<usize>, fragment: &DcMstr, resolver: &dyn SyntaxRuleResolver, ) -> Result<Self::Owned>

Reconciles a typed replacement with its original source representation using resolver.

§Errors

Returns an error for invalid ranges or ambiguous source correspondence.

Implementors§