-
Notifications
You must be signed in to change notification settings - Fork 4
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
Small DX changes + more docs #61
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
@asmello any objection to renaming Also, do you have any opposition to me implementing edit: motivation for the let ptr = Pointer::from_static("/path/to/value");
let tokens: Vec<_> = ptr.tokens().collect();
assert_eq!(tokens, vec!["path", "to", "value"]); vs let ptr = Pointer::from_static("/path/to/value");
let tokens: Vec<_> = ptr.tokens().collect();
assert_eq!(tokens, vec![Token::new("path"), Token::new("to"), Token::new("value")]); |
This PR will be the second to last I want to finish. The next will contain a small change to |
I'm a bit on the fence on this one. While the improved ergonomics is nice, I'm a little afraid people won't realise that it uses the encoded version until they run into an unexpected edge case at runtime. Seems a bit error prone. By forcing straight I can change my mind on this, if it turns out to be a major pain point, but I'd err on the side of safety at first. EDIT: forgot to say, happy with the renames, didn't notice the inconsistency 👍 |
Sounds good to me.
…On Tue, Jul 9, 2024 at 2:44 PM André Mello ***@***.***> wrote:
Also, do you have any opposition to me implementing PartialEq<&str> for
Token (using the decoded value)?
I'm a bit on the fence on this one. While the improved ergonomics is nice,
I'm a little afraid people won't realise that it uses the encoded version
until they run into an unexpected edge case at runtime. Seems a bit error
prone. By forcing straight Token and Token comparison there's no room for
error.
I can change my mind on this, if it turns out to be a major pain point,
but I'd err on the side of safety at first.
—
Reply to this email directly, view it on GitHub
<#61 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIGFZCVPGJLST2VZB7YNNDZLQVQJAVCNFSM6AAAAABKTH5CM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJYGQYDOMJYHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Also worth adding a comment so we remember we deliberately chose not to implement this. |
@asmello i went ahead and removed serde from |
Cool, I think that's reasonable. It's not immediately useful and there's ambiguity with encoding. 👍 |
PointerBuf::replace_token
toreplace
,ReplaceTokenError
toReplaceError
PointerBuf::push_back
,PointerBuf::push_front
,PointerBuf::replace
to acceptT: Into<Token>
From
all integer types forToken