plexor-codec-serde-json 0.1.0-alpha.1

JSON codec implementation for the Plexo distributed system architecture using Serde.
Documentation

Plexor Codec: Serde JSON

plexor-codec-serde-json provides a JSON codec implementation for the Plexor distributed system architecture.

It enables Neurons to serialize and deserialize payloads using the industry-standard serde_json library, making it ideal for human-readable messaging, and debugging.

Features

  • Seamless Integration: Implements the Codec trait for plexor-core.
  • Type Safety: Leverages Rust's strong typing via serde::Serialize and serde::Deserialize.
  • Flexibility: Works with any type that implements Serde traits.

Usage

1. Add Dependencies

[dependencies]
plexor-core = "0.1.0-alpha.1"
plexor-codec-serde-json = "0.1.0-alpha.1"
serde = { version = "1.0", features = ["derive"] }

2. Define a Message

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MyMessage {
    pub content: String,
    pub count: u32,
}

3. Use in a Neuron

use plexor_core::neuron::NeuronImpl;
use plexor_core::namespace::NamespaceImpl;
use plexor_codec_serde_json::SerdeJsonCodec;
use std::sync::Arc;

// Define the Neuron using the JSON codec
let neuron = NeuronImpl::<MyMessage, SerdeJsonCodec>::new_arc(
    Arc::new(NamespaceImpl {
        delimiter: ".",
        parts: vec!["my", "message"],
    })
);

License

Mozilla Public License, version 2.0.