serde_magnus-0.1.0 has been yanked.
serde_magnus
serde_magnus converts between Rust and Ruby data structures using Serde and Magnus.
Quick links
Usage
The serde_magnus::serialize function converts from a Rust type implementing the
serde::Serialize trait into a Ruby equivalent.
use Serialize;
use ;
use serialize;
let post = Post ;
let post: Value = serialize.unwrap;
// Output:
//
// {
// title: "Spring carnival planning update",
// content: "Here's what's new.",
// author: {
// name: "Martha",
// email_address: "martha@example.com"
// },
// tags: ["carnival", "update"]
// }
let _: Value = eval!.unwrap;
serde_magnus::deserialize converts from a Ruby value to a Rust type implementing
serde::Deserialize.
use RHash;
use Deserialize;
let post: RHash = eval!.unwrap;
let post: Post = deserialize.unwrap;
// Output:
//
// Post {
// title: "Spring carnival planning update",
// content: "Here's what's new.",
// author: Author {
// name: "Martha",
// email_address: "martha@example.com"
// },
// tags: ["carnival", "update"]
// }
println!;
Requirements
serde_magnus requires Rust 1.51+ and Ruby 2.6+.
License
serde_magnus is released under the terms of the MIT License. See LICENSE for details.