ada-url / rust

Rust bindings for Ada URL parser
https://crates.io/crates/ada-url
Apache License 2.0
86 stars 12 forks source link

feat: remove `mut` #28

Closed KSXGitHub closed 1 year ago

KSXGitHub commented 1 year ago

@anonrig Is there any reason origin must take mutable self? If not, this can be merged. If there is a reason, feel free to close this PR.

KSXGitHub commented 1 year ago

@anonrig So you really just added mut there by mistake then?

anonrig commented 1 year ago

@anonrig So you really just added mut there by mistake then?

I think it had to do with origin returning a new string owned by the C, but I don't remember.

KSXGitHub commented 1 year ago

@anonrig But the origin method still doesn't modify the internal state at all, right?

I think it had to do with origin returning a new string owned by the C

The origin method already returns &str, which is an immutable reference. The only guarantee you need to make is that the string must live at least as long as the Url struct.