Skip to main content

IntoStructural

Trait IntoStructural 

Source
pub trait IntoStructural<T>: Sized {
    // Required method
    fn into_structural(self) -> T;
}
Expand description

For conversions between structural types.

This trait has a blanket implementations for all types that implement FromStructural.

§Example

This example demonstrates how you can use IntoStructural as a bound.

use structural::convert::IntoStructural;

assert_eq!( into_other((0, 1, 2), [3, 4]), [[0, 1], [3, 4]] );

fn into_other<T, U>(left: T, right: U)-> [U;2]
where
    T: IntoStructural<U>,
{
    [left.into_structural(), right]
}

Required Methods§

Source

fn into_structural(self) -> T

Performs the conversion

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<This, T> IntoStructural<T> for This
where T: FromStructural<This>,