fn generate_associated_fn(
    original_function: ItemFn,
    new_signature: Signature,
    doc_string: String,
) -> TokenStream {
    let visibility = &original_function.vis;
    let arguments = new_signature.inputs.iter().skip(1).map(pattern_from_arg);
    let original_identifier = &original_function.sig.ident;

    let tokens = quote! {
        #original_function

        #[doc = #doc_string]
        #visibility #new_signature {
            !self.#original_identifier(#(#arguments),*)
        }
    };

    tokens.into()
}
/// Generates a negated function, where this function is
/// not associated.
///
/// # Examples
/// ```rust
/// use negate::negate;
///
/// struct Word(&'static str);
///
/// impl Word {
///     pub fn new(word: &'static str) -> Self {
///         Self (word)
///     }
///
///     #[negate]
///     pub fn is_uppercase(&self) -> bool {
///         self.0 == self.0.to_uppercase()
///     }
/// }
/// let my_name = Word::new("My Name");
/// assert!(my_name.is_not_uppercase());
/// ```
Generates a negated function, where this function is
not associated.
Generates a negated function where this function is not associated .
fn generate_associated_fn(
    original_function: ItemFn,
    new_signature: Signature,
    doc_string: String,
) -> TokenStream {
    let visibility = &original_function.vis;
    let arguments = new_signature.inputs.iter().skip(1).map(pattern_from_arg);
    let original_identifier = &original_function.sig.ident;
    let tokens = quote! {
        #original_function
        #[doc = #doc_string]
        #visibility #new_signature {
            !self.#original_identifier(#(#arguments),*)
        }
    };
    tokens.into()
}
fn generate_associated_fn ( original_function : ItemFn , new_signature : Signature , doc_string : String , ) -> TokenStream { let visibility = & original_function . vis ; let arguments = new_signature . inputs . iter ( ) . skip ( 1 ) . map ( pattern_from_arg ) ; let original_identifier = & original_function . sig . ident ; let tokens = quote ! { original_function [ doc doc_string ] visibility new_signature { self original_identifier ( ( arguments ) ) } } ; tokens . into ( ) }
Generates a negated function, where this function is
not associated.
Generates a negated function where this function is not associated .
original_function
ItemFn
new_signature
Signature
doc_string
String
examples
```rust
use negate::negate.

struct Word(&'static str).

impl Word {
pub fn new(word: &'static str) -> Self {
Self (word)
}

[negate]
pub fn is_uppercase(&self) -> bool {
self.0 == self.0.to_uppercase()
}
}
let my_name = Word::new("My Name");
assert!(my_name.is_not_uppercase());
```
` ` ` rust use negate :: negate . struct Word ( & ' static str ) . impl Word { pub fn new ( word : & ' static str ) - > Self { Self ( word ) } [ negate ] pub fn is_uppercase ( &self ) - > bool { self . 0 == self . 0 . to_uppercase () } } let my_name = Word :: new ( " My Name " ) ; assert! ( my_name . is_not_uppercase () ) ; ` ` `