Closed grego closed 2 years ago
Hey @grego, will do a review later today, just a quick note that I think it would be better to do #[ramhorns(callback = some_fn)]
with a raw ident, partly for readability, partly because it lets you us pass the correct span on call site in case there are some compile issues. I can do that later on my own if need be.
Sure, that's a good idea.
As syn::MetaNameValue
must contain a literal after =
, I've changed the syntax to #[ramhorns(callback(some_fn))]
where a raw ident can be used.
Yeah, it needs some manual work there, I'll give it a go in the morning, cheers :)
Please also bump the pulldown_cmark
dependency to 0.8
.
A new attribute
callback
is added, to be used as#[ramhorns(callback = "some_fn")
. For a field of typeT
, it allows one to pass a function of type(&T, &mut E) -> Result<(), E::Error)>
whereE: Encoder
to customise the rendering of the field.#[md]
attribute is replaced with#[ramhorns(md)]
for clarity and consistency with other attributes.render_cmark
method is deleted as it no longer serves a purpose (a callback is used instead).