structstruck
structstruck copied to clipboard
feature request: strikethrough for item visibility
Would it be feasible having a strikethrough-like option for item visibility?
Since this crate is usually aimed at 'data-container-like' structs, where usually all fields are pub, and repeating pub over and over is quite repetitive.
I've also tried using the public crate, but it didn't work as expected: it either only applied to the top level item when trying to use without strikethrough and with it, it tried to apply pub to enums, which is incompatible.
I would be interested in implementing this if possible.
Shouldn't be hard, would probably go into here.
But I also have run into situations where I'd like strikethrough, but not on enums. I think I'd like something more generic. Which do you think is better?
#[strikethrough[…], on = struct]#![ignorestrikethrough]/#![stopstrikethrough]to not apply strikethrough to self / self or any children
(Saner naming/syntax suggestions appreciated)
([Edit:] why not both?)
Shouldn't be hard, would probably go into here.
Ok, i'm going to look into it, thanks for the directions.
About the attribute, yes! why not both :); But I think the second alternative is more generally useful tho, i'll implement that first.
About the naming:
#[strikethrough[...], on = struct]seems good enough, but I'd remove the comma in that case.- I think
#![nostrike]would be more concise for skipping subtrees.#![strikethrough[..]]is a bit of a paper cut to type (since the lsp won't help you in this case) and I would not like to make it even longer than present. ('th', 'gh' is kinda bad to type for non native english speakers)
#[structstruck::each[fully_pub::fully_pub]] seems to do the trick, even for enums.