1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pub trait TryAsRef<T>
{
type Error;
fn try_as_ref(&self) -> Result<&T, Self::Error>;
}
impl<T, S> TryAsRef<T> for S
where
S: AsRef<T>,
{
type Error = crate::Never;
fn try_as_ref(&self) -> Result<&T, Self::Error> { Ok(self.as_ref()) }
}
// Todo: add TryAsMut
re_export_items_from_std_or_core!(convert);
pub mod prelude
{
#[allow(unused)]
pub use super::traits::*;
pub use super::{AsMut, AsRef, TryAsRef};
}
pub mod traits
{}
/*
pub trait TryAsMut<T>
{
type Error: Debug;
fn try_as_mut(&mut self) -> Result<&mut T,Self::Error>;
}
impl<T,S> TryAsMut<T> for S where S: AsMut<T>
{
type Error=Never;
fn try_as_mut(&mut self) -> Result<&mut T,Self::Error> { Ok(self.as_mut()) }
}
*/