-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Some small changes for consistency #8452
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
Conversation
|
@@ -707,16 +707,19 @@ pub mod traits {} | |||
/// Any vector that can be represented as a slice. | |||
pub trait Vector<T> { | |||
/// Work with `self` as a slice. | |||
fn as_slice<'a>(&'a self) -> &'a [T]; | |||
pub fn as_slice<'a>(&'a self) -> &'a [T]; |
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.
this pub
is redundant and soon to be an error(?)
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, yeah that is a leftover that I accidentally commited. Is the new rule that no visibility modifiers are allowed inside trait declarations?
@blake2-ppc: It's like |
Link to IRC snipped that motivated |
After some discussion on IRC I removed the |
Added into_owned() method for vectors Added DoubleEnded Iterator impl to Option Renamed nil.rs to unit.rs
- Methodyfied the string ascii extionsion functions - They got added recently, I wrapped them in a trait. - Added `into_owned()` method for vectors - similar to `Str`'s `into_owned()` function, allows to convert to a owned vector without making a copy if the source is a owned vector. - Added `or_some` method to option - similar to `unwrap_or_default`, but keeps the values wrapped in an `Option`. Useful for `Option` chains, eg Iterator impls. - Added `DoubleEndedIterator` impl to `Option` - Just for compatibility with generic Iterator functions. - Renamed nil.rs to unit.rs - the type got renamed ages ago, it's time the source file is as well.
into_owned()
method for vectors - similar toStr
'sinto_owned()
function, allows to convert to a owned vector without making a copy if the source is a owned vector.or_some
method to option - similar tounwrap_or_default
, but keeps the values wrapped in anOption
. Useful forOption
chains, eg Iterator impls.DoubleEndedIterator
impl toOption
- Just for compatibility with generic Iterator functions.