util/dictionary: add a dict! macro to create a dictionary

This commit is contained in:
meh 2015-10-26 20:25:44 +01:00
parent 0eb82bedf4
commit c66aa6efbb
3 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,7 @@ extern crate ffmpeg_sys as sys;
pub use sys as ffi; pub use sys as ffi;
#[macro_use]
pub mod util; pub mod util;
pub use util::error::Error; pub use util::error::Error;
pub use util::dictionary; pub use util::dictionary;

View File

@ -9,3 +9,17 @@ pub use self::owned::Owned;
mod iter; mod iter;
pub use self::iter::Iter; pub use self::iter::Iter;
#[macro_export]
macro_rules! dict {
( $($key:expr => $value:expr),* $(,)*) => ({
let mut dict = ::ffmpeg::Dictionary::new();
$(
dict.set($key, $value);
)*
dict
}
);
}

View File

@ -1,3 +1,4 @@
#[macro_use]
pub mod dictionary; pub mod dictionary;
pub mod error; pub mod error;
pub mod rational; pub mod rational;