Skip to content

Add #[track_calls] proc macro #8

Description

@tgross35

Super easy attribute macro. Input:

#[track_calls]
fn foo(a: i32, b: usize) -> Option<&str> {
    todo!()
}

Output:

fn foo(a: i32, b: usize) -> Option<&str> {
    debug!("entering foo");
    fn __inner(a: i32, b: usize) -> Option<&str> {
        todo!()
    }
    debug!("exiting foo");
    inner()
}

Or even with something like #[debug_calls(args, result]

fn foo(a: i32, b: usize) -> Option<&str> {
    #[derive(Debug)]
    struct Args {a: i32, b: usize}
    debug!("entering foo with values: {:?}", Args {a, b});
    
    fn inner(a: i32, b: usize) -> Option<&str> {
        todo!()
    }
    let ret = inner();
    debug!("exiting foo with {:?}", ret);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions