macro_rules! __parser_get__ {
    ($parser:expr, Bool($val:expr)) => { ... };
    ($parser:expr, Id($val:expr)) => { ... };
    ($parser:expr, Int($val:expr)) => { ... };
    ($parser:expr, Long($val:expr)) => { ... };
    ($parser:expr, Float($val:expr)) => { ... };
    ($parser:expr, Double($val:expr)) => { ... };
    ($parser:expr, Bytes($val:expr)) => { ... };
    ($parser:expr, Pointer($val:expr)) => { ... };
    ($parser:expr, Fd($val:expr)) => { ... };
    ($parser:expr, Rectangle($val:expr)) => { ... };
    ($parser:expr, Fraction($val:expr)) => { ... };
    ($parser:expr, Pod($val:expr)) => { ... };
    ($parser:expr, Struct { $( $field_type:tt $field:tt ),* $(,)? }) => { ... };
}
Expand description

Convenience macro to parse values from a spa pod using a spa pod parser.

For arguments, the macro accepts the parser, and then the structure of the desired pods:

parser_get!(<&mut libspa::pod::parser::Parser>, Bool(<&mut bool>));
parser_get!(<&mut libspa::pod::parser::Parser>, Id(<&mut libspa::utils::Id>));
parser_get!(<&mut libspa::pod::parser::Parser>, Int(<&mut i32>));
parser_get!(<&mut libspa::pod::parser::Parser>, Long(<&mut i64>));
parser_get!(<&mut libspa::pod::parser::Parser>, Float(<&mut f32>));
parser_get!(<&mut libspa::pod::parser::Parser>, Double(<&mut f64>));
parser_get!(<&mut libspa::pod::parser::Parser>, Bytes(<&mut &[u8]>));
parser_get!(<&mut libspa::pod::parser::Parser>, Pointer(<&mut *const c_void>));
parser_get!(<&mut libspa::pod::parser::Parser>, Fd(<&mut i64>));
parser_get!(<&mut libspa::pod::parser::Parser>, Rectangle(<&mut libspa::utils::Rectangle>));
parser_get!(<&mut libspa::pod::parser::Parser>, Fraction(<&mut libspa::utils::Fraction>));
parser_get!(<&mut libspa::pod::parser::Parser>, Pod(<&mut &libspa::pod::Pod>));
parser_get!(<&mut libspa::pod::parser::Parser>,
    Struct {
        // 0 to n fields, e.g.:
        Struct {
            Int(<&mut i32>),
            Float(<&mut f32>),
        },
        Bytes(<&mut &[u8]),
    }
);

§Returns

The macro returns a Result<(), Errno>. If parsing succeeds, an Ok(()) is returned. Otherwise, the Err(Errno) from the point where parsing failed is returned, and the rest of the values are not parsed.