IntoOwnedMap

Derive Macro IntoOwnedMap 

Source
#[derive(IntoOwnedMap)]
Expand description

Derive macro generating an impl of rustsynth::map::IntoOwnedMap.

This macro automatically generates an implementation that converts a struct into a VapourSynth map by storing each field as a map entry.

ยงExample

use rustsynth::IntoOwnedMap;

#[derive(IntoOwnedMap)]
struct MyStruct {
   field1: i32,
    field2: String,
}
let s = MyStruct { field1: 42, field2: "Hello".to_string() };
let map = s.into_owned_map();
assert_eq!(map.get::<i32>("field1").unwrap(), &42);
assert_eq!(map.get::<String>("field2").unwrap(), &"Hello".to_string());