Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support derive for enums, add ability to skip field type from is_type_tracked #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CertainLach
Copy link

is_type_tracked causes issue in this case:

#[derive(Trace)]
struct A {
    a: Box<A>,
}

Because it expands to

impl Trace for A {
    fn is_type_tracked() -> bool {
        A::is_type_tracked()
    }
}

It causes stack overflow

To address this issue, i added additional filter for derive: ignore_tracking:

struct A {
    #[ignore_tracking]
    a: Box<A>,
}

@CertainLach CertainLach force-pushed the synstructure-derive branch 2 times, most recently from 1124cc2 to a3f194e Compare November 26, 2021 23:52
Signed-off-by: Yaroslav Bolyukin <[email protected]>
@quark-zju
Copy link
Owner

Thanks. Recursive structure is a known issue. Is changing #[trace(skip)] to #[ignore_trace] because limitation of synstructure? I kind like #[trace(skip)] because it looks similar to what serde does.

@CertainLach
Copy link
Author

It isn't limitation of synstructure, but easing of implementation, as it is harder to implement parsing of trace(skip) attribute

Forgot about i changed this while making this PR, will implement original style of this attribute

@CertainLach CertainLach marked this pull request as draft December 20, 2021 15:35
@CertainLach
Copy link
Author

Well, it was hard to implement prettier syntax using synstructure, and because everyone implements synstructure subset in own crates nowadays, i created this abdomination

To use advantages of new macro implementation i also added with attribute, which allows to delegate tracing of single field (potentially foreign) to custom function

@CertainLach CertainLach marked this pull request as ready for review March 21, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants