Skip to main content

AsView

Trait AsView 

Source
pub trait AsView: Sized {
    type ViewType: Default;

    // Required methods
    fn as_view(&self) -> Self::ViewType;
    fn from_view(view: Self::ViewType) -> Self;
}
Expand description

AsView

Recursive for all field/value nodes from_view is infallible; view values are treated as canonical.

Required Associated Types§

Required Methods§

Source

fn as_view(&self) -> Self::ViewType

Source

fn from_view(view: Self::ViewType) -> Self

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 AsView for bool

Source§

type ViewType = bool

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for f32

Source§

type ViewType = f32

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for f64

Source§

type ViewType = f64

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for i8

Source§

type ViewType = i8

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for i16

Source§

type ViewType = i16

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for i32

Source§

type ViewType = i32

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for i64

Source§

type ViewType = i64

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for u8

Source§

type ViewType = u8

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for u16

Source§

type ViewType = u16

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for u32

Source§

type ViewType = u32

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for u64

Source§

type ViewType = u64

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl AsView for ()

Source§

type ViewType = ()

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view((): Self::ViewType) -> Self

Source§

impl AsView for String

Source§

type ViewType = String

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<K, V> AsView for BTreeMap<K, V>
where K: AsView + Ord + Clone, V: AsView,

Source§

type ViewType = Vec<(<K as AsView>::ViewType, <V as AsView>::ViewType)>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<K, V, S> AsView for HashMap<K, V, S>
where K: AsView + Eq + Hash + Clone, V: AsView, S: BuildHasher + Default,

Source§

type ViewType = Vec<(<K as AsView>::ViewType, <V as AsView>::ViewType)>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<T> AsView for BTreeSet<T>
where T: AsView + Ord + Clone,

Source§

type ViewType = Vec<<T as AsView>::ViewType>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<T, S> AsView for HashSet<T, S>
where T: AsView + Eq + Hash + Clone, S: BuildHasher + Default,

Source§

type ViewType = Vec<<T as AsView>::ViewType>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<T: AsView> AsView for Option<T>

Source§

type ViewType = Option<<T as AsView>::ViewType>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<T: AsView> AsView for Box<T>

Source§

type ViewType = <T as AsView>::ViewType

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Source§

impl<T: AsView> AsView for Vec<T>

Source§

type ViewType = Vec<<T as AsView>::ViewType>

Source§

fn as_view(&self) -> Self::ViewType

Source§

fn from_view(view: Self::ViewType) -> Self

Implementors§