structstruck icon indicating copy to clipboard operation
structstruck copied to clipboard

feature request: strikethrough for item visibility

Open Luctins opened this issue 1 year ago • 2 comments

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.

Luctins avatar Oct 31 '24 17:10 Luctins

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?)

jcaesar avatar Oct 31 '24 23:10 jcaesar

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)

Luctins avatar Nov 01 '24 12:11 Luctins

#[structstruck::each[fully_pub::fully_pub]] seems to do the trick, even for enums.

jcaesar avatar Jun 26 '25 11:06 jcaesar