Skip to main content

CodecPrism

Trait CodecPrism 

Source
pub trait CodecPrism {
    // Required methods
    fn parse(&self, cx: &mut Cx, text: &str) -> PrismParse;
    fn encode(
        &self,
        cx: &mut Cx,
        id: &SemanticId,
        position: EncodePosition,
    ) -> PrismEncode;
    fn round_trip(
        &self,
        cx: &mut Cx,
        text: &str,
        position: EncodePosition,
    ) -> RoundTrip;
}
Expand description

A codec-aware editor contract for one codec surface.

Required Methods§

Source

fn parse(&self, cx: &mut Cx, text: &str) -> PrismParse

Parses text into a semantic expression id, span map, and diagnostics.

Source

fn encode( &self, cx: &mut Cx, id: &SemanticId, position: EncodePosition, ) -> PrismEncode

Encodes a parsed semantic id at a target output position.

Source

fn round_trip( &self, cx: &mut Cx, text: &str, position: EncodePosition, ) -> RoundTrip

Parses, encodes, and reparses text to prove semantic identity.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§