You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: error_count_opts.rs
    path of file: ./repos/metered-rs/metered-macro/src
    
    the code of the file until where you have to start completion: //! The module supporting `#[error_count]` options

use syn::{
    parse::{Parse, ParseStream},
    Result,
};

use synattra::{types::KVOption, *};

use std::borrow::Cow;

pub struct ErrorCountOpts<'a> {
    pub name_ident: &'a syn::Ident,
    pub visibility: Cow<'a, syn::Visibility>,
    pub skip_cleared: bool,
}

pub struct ErrorCountKeyValAttribute {
    pub values: syn::punctuated::Punctuated<ErrorCountOption, Token![,]>,
}

impl ErrorCountKeyValAttribute {
    fn validate(&self, input: ParseStream<'_
    
    pub fn to_error_count_opts(&self) -> ErrorCountOpts<'_> {
        let name_ident = self
            .values
            .iter()
            .filter_map(|opt| {
                if let ErrorCountOption::Name(tpe) = opt {
                    Some(&tpe.value)
                } else {
                    None
                }
            })
            .next()
            .expect("There should be a name! This error cannot happen if the structure has been validated first!");

        let visibility = self
            .values
            .iter()
            .filter_map(|opt| {
                if let ErrorCountOption::Visibility(tpe) = opt {
                    Some(&tpe.value)
                } else {
                    None
                }
            })
            .next()
            .map(Cow::Borrowed)
            .unwrap_or_else(|| {
                Cow::Owned(syn::parse_str::<syn::Visibility>("pub(crate)").unwrap())
            });

        let skip_cleared = self
            .values
            .iter()
            .filter_map(|opt| {
                if let ErrorCountOption::SkipCleared(tpe) = opt {
                    Some(&tpe.value)
                } else {
                    None
                }
            })
            .next()
            .map(|value| value.value)
            .unwrap_or(cfg!(feature = "error-count-skip-cleared-by-default"));

        ErrorCountOpts {
            name_ident,
            visibility,
            skip_cleared,
        }
    }