-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Created as_span method #224
Conversation
We're already breaking all sorts of compatibility with 2.0.0 on the horizon. Not sure I would bother too much with maintaining compatibility. Looks good otherwise though 👍 |
pest/src/iterators/pair.rs
Outdated
@@ -123,6 +123,35 @@ impl<'i, R: RuleType> Pair<'i, R> { | |||
/// ``` | |||
#[inline] | |||
pub fn into_span(self) -> Span<'i> { | |||
// into_span was here first, so it is left in for backwards compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to mark this as deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could replace the documentation with a message to mention that it is deprecated. There is currently no better way to do that in Rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid there might be. Seems to be stabilized too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Yes you are right. I was thinking of the stability attributes.
pest/src/iterators/pair.rs
Outdated
self.as_span() | ||
} | ||
|
||
/// Returns the `Span` defined by the `Pair`, **without** consuming it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the documentation the same for both. The only difference is that the deprecated one should point here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure no problem
@jstnlef I would keep backwards compatibility here since this is a pretty popular method and it's pretty simple to deprecate. |
I deprecated The docs for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the versioning change!
pest/src/iterators/pair.rs
Outdated
@@ -122,7 +124,34 @@ impl<'i, R: RuleType> Pair<'i, R> { | |||
/// assert_eq!(pair.into_span().as_str(), "ab"); | |||
/// ``` | |||
#[inline] | |||
#[deprecated(since="1.0.7", note="Please use `as_span` instead")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to 2.0.0
.
Done. :) |
Fixes #223.
I left
into_span
so that this change is backwards compatible.into_span
is now implemented in terms ofas_span
because they do the same thing.Since the two methods are mostly the same, the test is also pretty much exactly the same. I added an extra part at the end to make sure that the pair is not consumed by the method.