Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting parse function that takes in Data instead of String #272

Open
bjo0 opened this issue Jul 8, 2024 · 1 comment
Open

Requesting parse function that takes in Data instead of String #272

bjo0 opened this issue Jul 8, 2024 · 1 comment

Comments

@bjo0
Copy link

bjo0 commented Jul 8, 2024

It would be convenient to have a version of the parse func that took in Data instead of String, as the conversion of Data to String involves transiting an Optional<String> function (String(data: encoding:)). This maybe looks superficially like not an inconvenience, but in practice it means I have to make my own error type in order to propagate failures at this step. If SwiftSoup did it and implemented the error type, it would improve ergonomics.

The function signature might be something like this:

func parse(data: Data) throws -> Document
@aehlke
Copy link
Collaborator

aehlke commented Aug 19, 2024

I will merge a PR for this if you want to implement it

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

No branches or pull requests

2 participants