@@ -24,25 +24,21 @@ use urid::UriBound;
2424/// #
2525/// # use urid::{URID, Uri, URIDCollection, uri, Map, UriBound};
2626/// # use std::any::Any;
27+ /// # use lv2_atom::atoms::scalar::Int;
28+ /// use lv2_options::collection::OptionsSerializer;
2729/// #
28- /// # impl<'a> OptionType<'a> for SomeIntOption {
29- /// # type AtomType = lv2_atom::scalar:: Int;
30+ /// # impl OptionType for SomeIntOption {
31+ /// # type AtomType = Int;
3032/// #
3133/// # fn from_option_value(value: &i32) -> Option<Self> {
3234/// # Some(Self(*value))
3335/// # }
3436/// #
35- /// # fn as_option_value(&'a self) -> &'a i32 {
37+ /// # fn as_option_value(&self) -> &i32 {
3638/// # &self.0
3739/// # }
3840/// # }
3941/// #
40- /// # #[derive(URIDCollection)]
41- /// pub struct PluginUridCollection {
42- /// some_int_option: URID<SomeIntOption>,
43- /// int: URID<lv2_atom::scalar::Int>,
44- /// }
45- /// #
4642/// # #[derive(FeatureCollection)]
4743/// # pub struct PluginFeatures<'a> {
4844/// # options: OptionsList<'a>,
@@ -51,7 +47,7 @@ use urid::UriBound;
5147/// # #[uri("urn:lv2_options:test:OptionablePlugin")]
5248/// pub struct OptionablePlugin {
5349/// some_int: SomeIntOption,
54- /// urids: PluginUridCollection ,
50+ /// some_int_serializer: OptionsSerializer<SomeIntOption> ,
5551/// }
5652/// #
5753/// # impl Plugin for OptionablePlugin {
@@ -82,26 +78,12 @@ use urid::UriBound;
8278/// pub struct SomeIntOption(i32);
8379///
8480/// impl OptionsInterface for OptionablePlugin {
85- /// fn get<'a>(&'a self, mut writer: OptionsWriter<'a>) -> Result<(), OptionsError> {
86- /// writer.process(|subject, options| match subject { // We will want to get/set our opions differently depending on the subject
87- /// Subject::Instance => { // In our case however, only our instance has an option
88- /// options.handle(self.urids.some_int_option, self.urids.int, || {
89- /// &self.some_int
90- /// });
91- /// }
92- /// _ => {}
93- /// })
81+ /// fn get<'a>(&'a self, mut requests: OptionRequestList<'a>) -> Result<(), OptionsError> {
82+ /// self.some_int_serializer.respond_to_requests(&self.some_int, &mut requests)
9483/// }
9584///
9685/// fn set(&mut self, options: OptionsList) -> Result<(), OptionsError> {
97- /// options.process(|subject, options| match subject {
98- /// Subject::Instance => {
99- /// options.handle(self.urids.some_int_option, self.urids.int, (), |value| {
100- /// self.some_int = value
101- /// })
102- /// }
103- /// _ => {}
104- /// })
86+ /// self.some_int_serializer.deserialize_to(&mut self.some_int, &options)
10587/// }
10688/// }
10789/// ```
0 commit comments