A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://doc.rust-lang.org/nightly/src/core/borrow.rs.html below:

borrow.rs - source

1#![stable(feature = "rust1", since = "1.0.0")]
4
5#[stable(feature = "rust1", since = "1.0.0")]
156#[rustc_diagnostic_item = "Borrow"]
157pub trait Borrow<Borrowed: ?Sized> {
158    #[stable(feature = "rust1", since = "1.0.0")]
178    fn borrow(&self) -> &Borrowed;
179}
180
181#[stable(feature = "rust1", since = "1.0.0")]
187#[rustc_diagnostic_item = "BorrowMut"]
188pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
189    #[stable(feature = "rust1", since = "1.0.0")]
205    fn borrow_mut(&mut self) -> &mut Borrowed;
206}
207
208#[stable(feature = "rust1", since = "1.0.0")]
209impl<T: ?Sized> Borrow<T> for T {
210    #[rustc_diagnostic_item = "noop_method_borrow"]
211    fn borrow(&self) -> &T {
212        self
213    }
214}
215
216#[stable(feature = "rust1", since = "1.0.0")]
217impl<T: ?Sized> BorrowMut<T> for T {
218    fn borrow_mut(&mut self) -> &mut T {
219        self
220    }
221}
222
223#[stable(feature = "rust1", since = "1.0.0")]
224impl<T: ?Sized> Borrow<T> for &T {
225    fn borrow(&self) -> &T {
226        self
227    }
228}
229
230#[stable(feature = "rust1", since = "1.0.0")]
231impl<T: ?Sized> Borrow<T> for &mut T {
232    fn borrow(&self) -> &T {
233        self
234    }
235}
236
237#[stable(feature = "rust1", since = "1.0.0")]
238impl<T: ?Sized> BorrowMut<T> for &mut T {
239    fn borrow_mut(&mut self) -> &mut T {
240        self
241    }
242}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4