#![doc(html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png")]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico"
)]
#![doc(html_root_url = "https://docs.rs/async_from/latest/async_from/")]
#![ cfg_attr( doc, doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "readme.md" ) ) ) ]
#![ cfg_attr( not( doc ), doc = "Async conversion utilities" ) ]
#[ cfg( feature = "enabled" ) ]
pub mod dependency
{
pub use ::async_trait;
}
#[ cfg( feature = "enabled" ) ]
mod private
{
#[ cfg( any( feature = "async_from", feature = "async_try_from" ) ) ]
pub use async_trait::async_trait;
#[ cfg( feature = "async_try_from" ) ]
use core::fmt::Debug;
#[ cfg( feature = "async_from" ) ]
#[ async_trait ]
pub trait AsyncFrom< T > : Sized {
async fn async_from(value: T) -> Self;
}
#[ async_trait ]
#[ cfg( feature = "async_from" ) ]
pub trait AsyncInto< T > : Sized {
async fn async_into(self) -> T;
}
#[ async_trait ]
#[ cfg( feature = "async_from" ) ]
impl< T, U > AsyncInto< U > for T
where
U: AsyncFrom< T > + Send,
T: Send,
{
async fn async_into(self) -> U
{
U ::async_from(self).await
}
}
#[ async_trait ]
#[ cfg( feature = "async_try_from" ) ]
pub trait AsyncTryFrom< T > : Sized {
type Error: Debug;
async fn async_try_from(value: T) -> Result< Self, Self ::Error >;
}
#[ async_trait ]
#[ cfg( feature = "async_try_from" ) ]
pub trait AsyncTryInto< T > : Sized {
type Error: Debug;
async fn async_try_into(self) -> Result< T, Self ::Error >;
}
#[ async_trait ]
#[ cfg( feature = "async_try_from" ) ]
impl< T, U > AsyncTryInto< U > for T
where
U: AsyncTryFrom< T > + Send,
T: Send,
{
type Error = U ::Error;
async fn async_try_into(self) -> Result< U, Self ::Error >
{
U ::async_try_from(self).await
}
}
}
#[ cfg( feature = "enabled" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use own :: *;
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod own
{
use super :: *;
#[ doc( inline ) ]
pub use orphan :: *;
}
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod orphan
{
use super :: *;
#[ doc( inline ) ]
pub use exposed :: *;
}
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod exposed
{
use super :: *;
#[ doc( inline ) ]
pub use prelude :: *;
#[ doc( inline ) ]
pub use ::async_trait ::async_trait;
#[ cfg( feature = "async_from" ) ]
pub use private :: { AsyncFrom, AsyncInto };
#[ cfg( feature = "async_try_from" ) ]
pub use private :: { AsyncTryFrom, AsyncTryInto };
}
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod prelude
{
use super :: *;
}