Add "length" as doc alias to len methods
This commit is contained in:
parent
6c523a7a0e
commit
9e779986aa
@ -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()
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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())
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
@ -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()
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user