Add "length" as doc alias to len methods

This commit is contained in:
Konrad Borowski 2020-12-28 09:13:46 +01:00
parent 6c523a7a0e
commit 9e779986aa
13 changed files with 13 additions and 0 deletions

View File

@ -915,6 +915,7 @@ pub fn into_vec(self) -> Vec<T> {
///
/// assert_eq!(heap.len(), 2);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
self.data.len()

View File

@ -2132,6 +2132,7 @@ pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
/// a.insert(1, "a");
/// assert_eq!(a.len(), 1);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
pub const fn len(&self) -> usize {

View File

@ -975,6 +975,7 @@ pub fn iter(&self) -> Iter<'_, T> {
/// v.insert(1);
/// assert_eq!(v.len(), 1);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
pub const fn len(&self) -> usize {

View File

@ -593,6 +593,7 @@ pub fn is_empty(&self) -> bool {
/// dl.push_back(3);
/// assert_eq!(dl.len(), 3);
/// ```
#[doc(alias = "length")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {

View File

@ -1038,6 +1038,7 @@ pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) {
/// v.push_back(1);
/// assert_eq!(v.len(), 1);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
count(self.tail, self.head, self.cap())

View File

@ -1388,6 +1388,7 @@ pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
/// assert_eq!(fancy_f.len(), 4);
/// assert_eq!(fancy_f.chars().count(), 3);
/// ```
#[doc(alias = "length")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {

View File

@ -1559,6 +1559,7 @@ pub fn clear(&mut self) {
/// let a = vec![1, 2, 3];
/// assert_eq!(a.len(), 3);
/// ```
#[doc(alias = "length")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {

View File

@ -91,6 +91,7 @@ pub trait ExactSizeIterator: Iterator {
///
/// assert_eq!(5, five.len());
/// ```
#[doc(alias = "length")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn len(&self) -> usize {

View File

@ -84,6 +84,7 @@ impl<T> [T] {
/// let a = [1, 2, 3];
/// assert_eq!(a.len(), 3);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_slice_len", since = "1.32.0")]
#[inline]

View File

@ -138,6 +138,7 @@ impl str {
/// assert_eq!("ƒoo".len(), 4); // fancy f!
/// assert_eq!("ƒoo".chars().count(), 3);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_str_len", since = "1.32.0")]
#[inline]

View File

@ -448,6 +448,7 @@ pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
/// a.insert(1, "a");
/// assert_eq!(a.len(), 1);
/// ```
#[doc(alias = "length")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
self.base.len()

View File

@ -199,6 +199,7 @@ pub fn iter(&self) -> Iter<'_, T> {
/// v.insert(1);
/// assert_eq!(v.len(), 1);
/// ```
#[doc(alias = "length")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {

View File

@ -653,6 +653,7 @@ pub fn is_empty(&self) -> bool {
/// let os_str = OsStr::new("foo");
/// assert_eq!(os_str.len(), 3);
/// ```
#[doc(alias = "length")]
#[stable(feature = "osstring_simple_functions", since = "1.9.0")]
pub fn len(&self) -> usize {
self.inner.inner.len()