pub fn conversion_helper_impl(&self) -> Result<TokenStream, Error> {
            let trait_name = &self.conversion_helper_trait_name;
            Ok(quote! {
                #[doc(hidden)]
                #[allow(dead_code, non_camel_case_types, non_snake_case)]
                pub trait #trait_name<T> {
                    fn into_value<F: FnOnce() -> T>(self, default: F) -> T;
                }

                impl<T> #trait_name<T> for () {
                    fn into_value<F: FnOnce() -> T>(self, default: F) -> T {
                        default()
                    }
                }

                impl<T> #trait_name<T> for (T,) {
                    fn into_value<F: FnOnce() -> T>(self, _: F) -> T {
                        self.0
                    }
                }
            })
        }
// TODO: once the proc-macro crate limitation is lifted, make this an
// util trait of this crate.
once the proc-macro crate limitation is lifted, make this an
util trait of this crate.
once the proc - macro crate limitation is lifted make this an util trait of this crate .
pub fn conversion_helper_impl(&self) -> Result<TokenStream, Error> {
            let trait_name = &self.conversion_helper_trait_name;
            Ok(quote! {
                #[doc(hidden)]
                #[allow(dead_code, non_camel_case_types, non_snake_case)]
                pub trait #trait_name<T> {
                    fn into_value<F: FnOnce() -> T>(self, default: F) -> T;
                }
                impl<T> #trait_name<T> for () {
                    fn into_value<F: FnOnce() -> T>(self, default: F) -> T {
                        default()
                    }
                }
                impl<T> #trait_name<T> for (T,) {
                    fn into_value<F: FnOnce() -> T>(self, _: F) -> T {
                        self.0
                    }
                }
            })
        }
pub fn conversion_helper_impl ( & self ) -> Result < TokenStream , Error > { let trait_name = & self . conversion_helper_trait_name ; Ok ( quote ! { [ doc ( hidden ) ] [ allow ( dead_code non_camel_case_types non_snake_case ) ] pub trait trait_name T { fn into_value F FnOnce ( ) T ( self default F ) T } impl T trait_name T for ( ) { fn into_value F FnOnce ( ) T ( self default F ) T { default ( ) } } impl T trait_name T for ( T ) { fn into_value F FnOnce ( ) T ( self F ) T { self 0 } } } ) }
TODO: once the proc-macro crate limitation is lifted, make this an
util trait of this crate.
TODO : once the proc - macro crate limitation is lifted make this an util trait of this crate .
&self
&self