newer_type_std/
convert.rs1use crate::emit_traits;
2use newer_type::target;
3
4emit_traits! {
5 #[implement_of(for<T> newer_type_std::convert::AsRef<T>)]
6 #[slot(u8)]
7 #[target(alternative = ::core::convert::AsRef)]
8 pub trait AsRef[T: ?::core::marker::Sized] {
9 fn as_ref(&self) -> &T;
10 }
11
12 #[implement_of(for<T> newer_type_std::convert::AsMut<T>)]
13 #[slot(u8)]
14 #[target(alternative = ::core::convert::AsMut)]
15 pub trait AsMut[T: ?::core::marker::Sized] {
16 fn as_mut(&mut self) -> &mut T;
17 }
18
19 #[implement_of(newer_type_std::convert::Into<u32>)]
20 #[slot(char)]
21 #[target(alternative = ::core::convert::Into)]
22 pub trait Into[T]: [::core::marker::Sized] {
23 fn into(self) -> T;
24 }
25
26 #[implement_of(newer_type_std::convert::TryInto<u8>)]
27 #[slot(i32)]
28 #[target(alternative = ::core::convert::TryInto)]
29 pub trait TryInto[T]: [::core::marker::Sized] {
30 type Error;
31 fn try_into(self) -> ::core::result::Result<T, Self::Error>;
32 }
33}