Semantic getter

This commit is contained in:
Andrzej Głuszak 2021-09-29 14:04:32 +02:00
parent 6c7526d308
commit 98676efdc5
9 changed files with 401 additions and 63 deletions

View file

@ -35,6 +35,7 @@
//! fmt: result
//! bool_impl: option, fn
//! add:
//! as_ref: sized
pub mod marker {
// region:sized
@ -113,8 +114,9 @@ pub mod clone {
}
// endregion:clone
// region:from
pub mod convert {
// region:from
pub trait From<T>: Sized {
fn from(_: T) -> Self;
}
@ -136,8 +138,14 @@ pub mod convert {
t
}
}
// endregion:from
// region:as_ref
pub trait AsRef<T: ?Sized> {
fn as_ref(&self) -> &T;
}
// endregion:as_ref
}
// endregion:from
pub mod ops {
// region:coerce_unsized
@ -609,6 +617,7 @@ pub mod prelude {
cmp::{Eq, PartialEq}, // :eq
cmp::{Ord, PartialOrd}, // :ord
convert::{From, Into}, // :from
convert::AsRef, // :as_ref
default::Default, // :default
iter::{IntoIterator, Iterator}, // :iterator
macros::builtin::derive, // :derive