From: Kostya Shishkov Date: Sat, 20 May 2017 13:42:08 +0000 (+0200) Subject: minor register improvements X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=34829caaa66f6842c2649fc0b4496a9d12454766;p=nihav.git minor register improvements --- diff --git a/src/register.rs b/src/register.rs index d4f72af..a3f3e45 100644 --- a/src/register.rs +++ b/src/register.rs @@ -1,6 +1,6 @@ use std::fmt; -#[derive(Debug,Clone,Copy)] +#[derive(Debug,Clone,Copy,PartialEq)] #[allow(dead_code)] pub enum CodecType { Video, @@ -28,6 +28,7 @@ const CODEC_CAP_REORDER:u32 = 0x000004; const CODEC_CAP_HYBRID:u32 = 0x000008; const CODEC_CAP_SCALABLE:u32 = 0x000010; +#[derive(Clone)] pub struct CodecDescription { name: &'static str, fname: &'static str, @@ -108,9 +109,9 @@ macro_rules! desc { } pub fn get_codec_description(name: &str) -> Option<&'static CodecDescription> { - for i in 0..CODEC_REGISTER.len() { - if CODEC_REGISTER[i].name == name { - return Some(&CODEC_REGISTER[i]); + for reg in CODEC_REGISTER { + if reg.name == name { + return Some(reg); } } None