serde_magnus 0.11.0

Serde integration for Magnus
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::error::Error;
use magnus::{IntoValue, Ruby, Value};

pub fn nest<Data>(ruby: &Ruby, variant: &'static str, data: Data) -> Result<Value, Error>
where
    Data: IntoValue,
{
    let hash = ruby.hash_new();
    hash.aset(variant, data)?;
    Ok(hash.into_value_with(ruby))
}