chipsenkbeil / vimwiki-rs

Rust library and tooling to parse, render, and modify vimwiki text and files.
56 stars 2 forks source link

Update elements to use Cow for enums #101

Closed chipsenkbeil closed 3 years ago

chipsenkbeil commented 3 years ago

To be fully capable of passing references around, we need Element, BlockElement, InlineElement, InlineBlockElement, Comment, maybe DecoratedText and DecoratedTextContent, maybe Link, and any other enums that traditionally are taking some other data to instead take a Cow<'a, DATA> so we can dynamically wrap references rather than cloning.

This is helpful when producing children where the return type could be one of many elements, etc.

chipsenkbeil commented 3 years ago

Not necessary and more annoying to figure out because we'd have nested Cow for ownership. Closing out.