This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait AsRef<T: ?Sized> { | |
| fn convert_as_ref(&self) -> &T; | |
| } | |
| trait Into<T> { | |
| fn convert_into(self) -> T; | |
| } | |
| trait From<T> { | |
| fn from(T) -> Self; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // As lifts over Deref | |
| impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> { | |
| fn as_ref(&self) -> &U { | |
| self.deref().as_ref() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait Rand<Distribution> { | |
| type Stream: RandStream<T>; | |
| fn rand(dist: Distribution) -> Stream; | |
| } | |
| trait RandStream<T> { | |
| fn next<R: Rng>(&self, rng: &mut R) -> T; | |
| } | |
| impl Rand<Range<u32, u32>> for u32 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait Rand<Rng, Distribution> { | |
| type Iter: Iterator<Item = Self>; | |
| fn rand(rng: Rng, dist: Distribution) -> Iter; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn nonparametric<T: 'static>(t: T) { | |
| let b: Box<Any> = box t; | |
| match b.downcast::<SomeConcreteType>() { | |
| ... | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait CoerceFrom<T> { | |
| fn coerce_from(T) -> Self; | |
| } | |
| trait Coerce { | |
| fn coerce<T>(self) -> T where T: CoerceFrom<Self>; | |
| } | |
| impl<T> Coerce for T { | |
| fn coerce<U: CoerceFrom<T>>(self) -> U { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Types: Path and path (later being unsized) | |
| impl Deref<path> for Path { ... } | |
| fn new<T: BytesContainer>(path: T) -> Path | |
| fn dir(&self) -> &path | |
| impl Path { | |
| fn new<T: BytesContainer>(path: T) -> Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn nth(&mut self, mut n: uint) -> Option<A> { | |
| for x in *self { | |
| if n == 0 { return Some(x) } | |
| n -= 1; | |
| } | |
| None | |
| } | |
| error: cannot borrow immutable local variable `self` as mutable | |
| for x in *self { |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; ModuleID = 'test-addrinfo.0.rs' | |
| target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" | |
| target triple = "x86_64-pc-windows-gnu" | |
| %str_slice = type { i8*, i64 } | |
| %"struct.core::intrinsics::TypeId<[]>[#3]" = type { i64 } | |
| %"struct.task::Ops<[]>" = type { %"struct.rustrt::mutex::NativeMutex<[]>[#9]", i8, { i64, i64 }, i64 } | |
| %"struct.rustrt::mutex::NativeMutex<[]>[#9]" = type { %"struct.rustrt::mutex::StaticNativeMutex<[]>[#9]", i8 } | |
| %"struct.rustrt::mutex::StaticNativeMutex<[]>[#9]" = type { %"struct.rustrt::mutex::imp::Mutex<[]>[#9]" } | |
| %"struct.rustrt::mutex::imp::Mutex<[]>[#9]" = type { %"struct.core::atomic::AtomicUint<[]>[#3]", %"struct.core::atomic::AtomicUint<[]>[#3]" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| failures: | |
| ---- io::net::addrinfo::test::dns_smoke_test stdout ---- | |
| task 'io::net::addrinfo::test::dns_smoke_test' panicked at 'called `Result::unwrap()` on an `Err` value: OS Error 0: The operation completed successfully. | |
| ', C:\msys64\home\aturon\rust\src\libcore\result.rs:788 |
NewerOlder