Open
Description
html5ever/html5ever/src/tokenizer/interface.rs
Lines 83 to 99 in 4641184
The TokenSink
trait's process_token
method takes &self
Many usecases for a TokenSink
are going to involve mutability. This includes multiple files in this repo such as tree_builder.
I think TokenSink
would be better like this:
pub trait TokenSink {
type Handle;
fn process_token(self, token: Token, line_number: u64) -> TokenSinkResult<Self::Handle>;
fn end(self);
fn adjusted_current_node_present_but_not_in_html_namespace(self);
}
Usecases that need mutability could then be impl TokenSink for &mut MyTokenSink
, and those that don't like the printer examples can be impl TokenSink for &MyType
.
I haven't tried implementing this refactor, it might not actually work out well.
Metadata
Metadata
Assignees
Labels
No labels