///
/// This will decrement the strong reference count. If the strong reference
/// count reaches zero then the only other references (if any) are
- /// [`Weak`][weak], so we `drop` the inner value.
- ///
- /// [weak]: struct.Weak.html
+ /// [`Weak`], so we `drop` the inner value.
///
/// # Examples
///
impl<T> Weak<T> {
/// Constructs a new `Weak<T>`, without allocating any memory.
- /// Calling [`upgrade`] on the return value always gives [`None`].
+ /// Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
///
- /// [`upgrade`]: struct.Weak.html#method.upgrade
/// [`None`]: ../../std/option/enum.Option.html
///
/// # Examples
#[stable(feature = "downgraded_weak", since = "1.10.0")]
impl<T> Default for Weak<T> {
/// Constructs a new `Weak<T>`, allocating memory for `T` without initializing
- /// it. Calling [`upgrade`] on the return value always gives [`None`].
+ /// it. Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
///
- /// [`upgrade`]: struct.Weak.html#method.upgrade
/// [`None`]: ../../std/option/enum.Option.html
///
/// # Examples
/// Implements the `+=` operator for appending to a `String`.
///
-/// This has the same behavior as the [`push_str`] method.
-///
-/// [`push_str`]: struct.String.html#method.push_str
+/// This has the same behavior as the [`push_str`][String::push_str] method.
#[stable(feature = "stringaddassign", since = "1.12.0")]
impl<'a> AddAssign<&'a str> for String {
#[inline]
///
/// This will decrement the strong reference count. If the strong reference
/// count reaches zero then the only other references (if any) are
- /// [`Weak`][weak], so we `drop` the inner value.
- ///
- /// [weak]: struct.Weak.html
+ /// [`Weak`], so we `drop` the inner value.
///
/// # Examples
///
#[stable(feature = "downgraded_weak", since = "1.10.0")]
impl<T> Default for Weak<T> {
/// Constructs a new `Weak<T>`, without allocating memory.
- /// Calling [`upgrade`] on the return value always gives [`None`].
+ /// Calling [`upgrade`][Weak::upgrade] on the return value always
+ /// gives [`None`].
///
- /// [`upgrade`]: struct.Weak.html#method.upgrade
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for Option<T> {
- /// Returns [`None`].
- ///
- /// [`None`]: #variant.None
+ /// Returns [`None`][Option::None].
#[inline]
fn default() -> Option<T> { None }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
- /// Takes each element in the [`Iterator`]: if it is [`None`], no further
- /// elements are taken, and the [`None`] is returned. Should no [`None`] occur, a
- /// container with the values of each `Option` is returned.
+ /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],
+ /// no further elements are taken, and the [`None`][Option::None] is
+ /// returned. Should no [`None`][Option::None] occur, a container with the
+ /// values of each [`Option`] is returned.
///
/// Here is an example which increments every integer in a vector,
/// checking for overflow:
/// ```
///
/// [`Iterator`]: ../iter/trait.Iterator.html
- /// [`None`]: enum.Option.html#variant.None
#[inline]
fn from_iter<I: IntoIterator<Item=Option<A>>>(iter: I) -> Option<V> {
// FIXME(#11084): This could be replaced with Iterator::scan when this
/// Returns an iterator over the possibly contained value.
///
- /// The iterator yields one value if the result is [`Ok`], otherwise none.
+ /// The iterator yields one value if the result is [`Result::Ok`], otherwise none.
///
/// # Examples
///
/// let x: Result<u32, &str> = Err("nothing!");
/// assert_eq!(x.iter().next(), None);
/// ```
- ///
- /// [`Ok`]: enum.Result.html#variant.Ok
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
/// Returns a mutable iterator over the possibly contained value.
///
- /// The iterator yields one value if the result is [`Ok`], otherwise none.
+ /// The iterator yields one value if the result is [`Result::Ok`], otherwise none.
///
/// # Examples
///
/// let mut x: Result<u32, &str> = Err("nothing!");
/// assert_eq!(x.iter_mut().next(), None);
/// ```
- ///
- /// [`Ok`]: enum.Result.html#variant.Ok
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<T> {
/// Returns a consuming iterator over the possibly contained value.
///
- /// The iterator yields one value if the result is [`Ok`], otherwise none.
+ /// The iterator yields one value if the result is [`Result::Ok`], otherwise none.
///
/// # Examples
///
/// let v: Vec<u32> = x.into_iter().collect();
/// assert_eq!(v, []);
/// ```
- ///
- /// [`Ok`]: enum.Result.html#variant.Ok
#[inline]
fn into_iter(self) -> IntoIter<T> {
IntoIter { inner: self.ok() }
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
impl Default for DefaultHasher {
- /// Creates a new `DefaultHasher` using [`new`]. See its documentation for more.
- ///
- /// [`new`]: #method.new
+ /// Creates a new `DefaultHasher` using [`new`][DefaultHasher::new].
+ /// See its documentation for more.
fn default() -> DefaultHasher {
DefaultHasher::new()
}
/// `.into_inner()` immediately after a seek yields the underlying reader
/// at the same position.
///
- /// To seek without discarding the internal buffer, use [`seek_relative`].
+ /// To seek without discarding the internal buffer, use [`Seek::seek_relative`].
///
- /// See `std::io::Seek` for more details.
+ /// See [`std::io::Seek`] for more details.
///
/// Note: In the edge case where you're seeking with `SeekFrom::Current(n)`
/// where `n` minus the internal buffer length overflows an `i64`, two
/// seeks will be performed instead of one. If the second seek returns
/// `Err`, the underlying reader will be left at the same position it would
/// have if you called `seek` with `SeekFrom::Current(0)`.
- ///
- /// [`seek_relative`]: #method.seek_relative
fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
let result: u64;
if let SeekFrom::Current(n) = pos {
impl<T> From<T> for Mutex<T> {
/// Creates a new mutex in an unlocked state ready for use.
/// This is equivalent to [`Mutex::new`].
- ///
- /// [`Mutex::new`]: #method.new
fn from(t: T) -> Self {
Mutex::new(t)
}
impl<T> From<T> for RwLock<T> {
/// Creates a new instance of an `RwLock<T>` which is unlocked.
/// This is equivalent to [`RwLock::new`].
- ///
- /// [`RwLock::new`]: #method.new
fn from(t: T) -> Self {
RwLock::new(t)
}