[][src]Enum insta::internals::Content

pub enum Content {
    Bool(bool),
    U8(u8),
    U16(u16),
    U32(u32),
    U64(u64),
    I8(i8),
    I16(i16),
    I32(i32),
    I64(i64),
    F32(f32),
    F64(f64),
    Char(char),
    String(String),
    Bytes(Vec<u8>),
    Seq(Vec<Content>),
    Map(Vec<(Content, Content)>),
    // some variants omitted
}

Represents variable typed content.

This is used internally for the serialization system to represent values before the actual snapshots are written.

Variants

Bool(bool)
U8(u8)
U16(u16)
U32(u32)
U64(u64)
I8(i8)
I16(i16)
I32(i32)
I64(i64)
F32(f32)
F64(f64)
Char(char)
String(String)
Bytes(Vec<u8>)
Seq(Vec<Content>)

Implementations

impl Content[src]

pub fn as_str(&self) -> Option<&str>[src]

Returns the value as string

pub fn as_u64(&self) -> Option<u64>[src]

Returns the value as u64

pub fn walk<F: FnMut(&mut Content) -> bool>(&mut self, visit: &mut F)[src]

Recursively walks the content structure mutably.

The callback is invoked for every content in the tree.

Trait Implementations

impl Clone for Content[src]

impl Debug for Content[src]

impl<'a> From<&'a [u8]> for Content[src]

impl<'a> From<&'a str> for Content[src]

impl From<()> for Content[src]

impl From<String> for Content[src]

impl From<Vec<u8>> for Content[src]

impl From<bool> for Content[src]

impl From<char> for Content[src]

impl From<f32> for Content[src]

impl From<f64> for Content[src]

impl From<i16> for Content[src]

impl From<i32> for Content[src]

impl From<i64> for Content[src]

impl From<i8> for Content[src]

impl From<u16> for Content[src]

impl From<u32> for Content[src]

impl From<u64> for Content[src]

impl From<u8> for Content[src]

impl Serialize for Content[src]

Auto Trait Implementations

impl RefUnwindSafe for Content

impl Send for Content

impl Sync for Content

impl Unpin for Content

impl UnwindSafe for Content

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.