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§
Sourcefn parse(&self, cx: &mut Cx, text: &str) -> PrismParse
fn parse(&self, cx: &mut Cx, text: &str) -> PrismParse
Parses text into a semantic expression id, span map, and diagnostics.
Sourcefn encode(
&self,
cx: &mut Cx,
id: &SemanticId,
position: EncodePosition,
) -> PrismEncode
fn encode( &self, cx: &mut Cx, id: &SemanticId, position: EncodePosition, ) -> PrismEncode
Encodes a parsed semantic id at a target output position.
Sourcefn round_trip(
&self,
cx: &mut Cx,
text: &str,
position: EncodePosition,
) -> RoundTrip
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".