pub struct JsonCodec;Expand description
JSON codec runtime object that round-trips every Expr through JSON.
Implements all codec roles – Decoder/Encoder, the located
LocatedDecoder/LocatedEncoder, and the tree
TreeDecoder/TreeEncoder – by projecting the shared Expr graph onto
$expr-tagged (and $located) serde_json::Value forms, so any expression
the kernel can hold survives a JSON round-trip losslessly.
Trait Implementations§
Source§impl LocatedDecoder for JsonCodec
impl LocatedDecoder for JsonCodec
Source§fn decode_located(
&self,
cx: &mut ReadCx<'_>,
input: Input,
_source_id: String,
) -> Result<LocatedExpr>
fn decode_located( &self, cx: &mut ReadCx<'_>, input: Input, _source_id: String, ) -> Result<LocatedExpr>
Source§impl LocatedEncoder for JsonCodec
impl LocatedEncoder for JsonCodec
Source§fn encode_located(
&self,
cx: &mut WriteCx<'_>,
expr: &LocatedExpr,
) -> Result<Output>
fn encode_located( &self, cx: &mut WriteCx<'_>, expr: &LocatedExpr, ) -> Result<Output>
Encode a
LocatedExpr, optionally using its origin for fidelity.Source§impl TreeDecoder for JsonCodec
impl TreeDecoder for JsonCodec
Source§fn decode_tree(
&self,
cx: &mut ReadCx<'_>,
input: Input,
_source_id: String,
) -> Result<LocatedExprTree>
fn decode_tree( &self, cx: &mut ReadCx<'_>, input: Input, _source_id: String, ) -> Result<LocatedExprTree>
Source§impl TreeEncoder for JsonCodec
impl TreeEncoder for JsonCodec
Source§fn encode_tree(
&self,
cx: &mut WriteCx<'_>,
expr: &LocatedExprTree,
) -> Result<Output>
fn encode_tree( &self, cx: &mut WriteCx<'_>, expr: &LocatedExprTree, ) -> Result<Output>
Encode a
LocatedExprTree, reproducing layout and trivia where present.Auto Trait Implementations§
impl Freeze for JsonCodec
impl RefUnwindSafe for JsonCodec
impl Send for JsonCodec
impl Sync for JsonCodec
impl Unpin for JsonCodec
impl UnsafeUnpin for JsonCodec
impl UnwindSafe for JsonCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more