7 releases

Uses new Rust 2021

0.2.2 Sep 10, 2022
0.2.1 May 18, 2022
0.2.0 Mar 20, 2022
0.1.3 Feb 14, 2022
0.1.2 Jan 13, 2022

#246 in Encoding

Download history 99/week @ 2022-06-10 100/week @ 2022-06-17 175/week @ 2022-06-24 362/week @ 2022-07-01 426/week @ 2022-07-08 298/week @ 2022-07-15 211/week @ 2022-07-22 545/week @ 2022-07-29 112/week @ 2022-08-05 95/week @ 2022-08-12 13/week @ 2022-08-19 13/week @ 2022-08-26 54/week @ 2022-09-02 131/week @ 2022-09-09 99/week @ 2022-09-16 121/week @ 2022-09-23

406 downloads per month

MIT/Apache

225KB
5.5K SLoC

serde_someip implements SOME/IP ontop of serde

use serde::{Serialize, Deserialize};
use serde_someip::SomeIp;
use serde_someip::options::ExampleOptions;

#[derive(Serialize, Deserialize, Debug, SomeIp)]
struct Point {
    #[someip(id = 0)]
    x: i32,
    #[someip(id = 1)]
    y: i32,
}

fn main() {
    let point = Point { x: 1, y: 2 };

    // Encode the message using someip.
    let serialized = serde_someip::to_vec::<ExampleOptions, _>(&point).unwrap();

    // Prints serialized = [0x20, 0, 0, 0 , 0, 1, 0x20, 1, 0, 0, 0, 2]
    println!("serialized = {:?}", serialized);

    //Decode the message using someip
    let deserialized: Point = serde_someip::from_slice::<ExampleOptions, _>(&serialized).unwrap();

    // Prints deserialized = Point { x: 1, y: 2 }
    println!("deserialized = {:?}", deserialized);
}

For more attributes used by derive(SomeIp) see the macro doc.

Also feel free to read the release notes

Available features

  • derive: Enables the SomeIp derive macro
  • describe: Enables various describe functions that can be used to describe the binary format of a concrete SomeIp type.
  • bytes: Enables to/from_bytes functions using the bytes crate

Dependencies

~130–385KB