Trait Into

Source
pub trait Into<T> {
    // Required method
    fn into(x: Self) -> T;
}

Required Methods§

Source

fn into(x: Self) -> T

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Into<Result<T, Error>> for Result<T>

Source§

fn into(x: Self) -> JsonRpcResult<T>

Source§

impl<T: Send + Sync + 'static> Into<Pin<Box<dyn Future<Output = T> + Send>>> for BoxFuture<T>

Source§

fn into(x: Self) -> BoxFuture<T>

Implementors§

Source§

impl Into<Error> for CoreError

Source§

impl<T> Into<Result<T, Error>> for CoreResult<T>

Source§

impl<T: Send + Sync + 'static> Into<Pin<Box<dyn Future<Output = Result<T, Error>> + Send>>> for CoreBoxFuture<T>

Source§

impl<T: Send + Sync + 'static> Into<Pin<Box<dyn Future<Output = Result<T, Error>> + Send>>> for CoreResult<T>

Sometimes an rpc method is implemented asynchronously, then the rpc trait definition must use BoxFuture for the return type.

This into conversion allow non-async rpc implementation method to return RpcResult straight-forward. The delegate! macro with #[into] attribute will automatically call this method to do the return type conversion.