Skip to content

Rename BrokenLinkCallback trait to ParserCallbacks - #1049

Merged
ollpu merged 5 commits into
pulldown-cmark:mainfrom
ollpu:rename-parser-callbacks
Nov 21, 2025
Merged

Rename BrokenLinkCallback trait to ParserCallbacks#1049
ollpu merged 5 commits into
pulldown-cmark:mainfrom
ollpu:rename-parser-callbacks

Conversation

@ollpu

@ollpu ollpu commented Jul 13, 2025

Copy link
Copy Markdown
Collaborator

Edit: #1043 maybe doesn't need a new callback, so this PR doesn't need to be merged separately from #1013.


We want to use the same trait for other callbacks as well, e.g. as in #1013 #1043.

Since there will be more callbacks to override, it makes sense to remove the existing blanket implementation for closures. To keep backwards compatibility with most old use cases, new_with_broken_link_callback uses a new wrapper type.

I tried to move the 'input lifetime from the trait to the callbacks themselves, but I still ran into rust-lang/rust#41078 when trying to pass closures to new_with_broken_link_callback. I guess it's fine as is.

Breaking change, so I created a new release branch.

Comment thread pulldown-cmark/src/parse.rs Outdated
Remove blanket impl of ParserCallbacks for closures. Replaced with a
wrapper type BrokenLinkCallback to support the old API.
ollpu added a commit to ollpu/pulldown-cmark that referenced this pull request Sep 10, 2025
No measurable performance impact in a quick benchmark:
pulldown-cmark#1049 (comment)
@ollpu
ollpu force-pushed the rename-parser-callbacks branch from b06e968 to b880cb7 Compare September 10, 2025 16:16
No measurable performance impact in a quick benchmark:
pulldown-cmark#1049 (comment)
@ollpu
ollpu force-pushed the rename-parser-callbacks branch from b880cb7 to 9c7b81a Compare September 10, 2025 16:20
@ollpu
ollpu requested a review from notriddle September 10, 2025 16:22
@ollpu
ollpu changed the base branch from branch-0.14 to master November 15, 2025 15:10
@ollpu

ollpu commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator Author

I'll go ahead and merge this with @notriddle's (slightly stale) review unless there are any objections

@ollpu
ollpu merged commit a574ea8 into pulldown-cmark:main Nov 21, 2025
6 checks passed
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