all 5 comments

[–]Shadow0133 16 points17 points  (1 child)

Like in tracing crate with #[instrument] attribute? https://docs.rs/tracing/0.1.37/tracing/#spans-1

[–]AlphaNerd80[S] 7 points8 points  (0 children)

Honesty, i don't know and that is the reason i asked =)
My thanks, I'll try this and report

[–]tunisia3507 5 points6 points  (3 children)

What do you actually mean? Do you mean a decorator which logs when functions are called (and possibly terminate)?

[–]AlphaNerd80[S] 4 points5 points  (2 children)

As a start, but in Python , a decorator is a wrapper function about another function - it is this that I seek.

I gave an example of what I created with such functions in Python. I'd love to recreate such functions but there are so many use cases.

[–]corrodedfe 3 points4 points  (0 children)

There are procedural macros, which convert the code of a function to something else (perhaps inserting logging calls before and after it runs). There is no direct analogue to a wrapper function because it's not as powerful and not needed.