Enum insta::internals::Content [−][src]
pub enum Content {
}
Expand description
Represents variable typed content.
This is used for the serialization system to represent values before the actual snapshots are written and is also exposed to dynamic redaction functions.
Some enum variants are intentionally not exposed to user code.
It’s generally recommended to construct content objects by
using the From
trait and by using the
accessor methods to assert on it.
While matching on the content is possible in theory it is
recommended against. The reason for this is that the content
enum holds variants that can “wrap” values where it’s not
expected. For instance if a field holds an Option<String>
you cannot use pattern matching to extract the string as it
will be contained in an internal Some
variant that is not
exposed. On the other hand the as_str
method will
automatically resolve such internal wrappers.
If you do need to pattern match you should use the
resolve_inner
method to resolve such internal wrappers.
Variants
Bool(bool)
Tuple Fields of Bool
0: bool
U8(u8)
Tuple Fields of U8
0: u8
U16(u16)
Tuple Fields of U16
0: u16
U32(u32)
Tuple Fields of U32
0: u32
U64(u64)
Tuple Fields of U64
0: u64
U128(u128)
Tuple Fields of U128
0: u128
I8(i8)
Tuple Fields of I8
0: i8
I16(i16)
Tuple Fields of I16
0: i16
I32(i32)
Tuple Fields of I32
0: i32
I64(i64)
Tuple Fields of I64
0: i64
I128(i128)
Tuple Fields of I128
0: i128
F32(f32)
Tuple Fields of F32
0: f32
F64(f64)
Tuple Fields of F64
0: f64
Char(char)
Tuple Fields of Char
0: char
String(String)
Tuple Fields of String
0: String
Implementations
This resolves the innermost content in a chain of wrapped content.
For instance if you encounter an Option<Option<String>>
field the content will be wrapped twice in an internal
option wrapper. If you need to pattern match you will
need in some situations to first resolve the inner value
before such matching can take place as there is no exposed
way to match on these wrappers.
This method does not need to be called for the as_
methods which resolve automatically.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Content
impl UnwindSafe for Content
Blanket Implementations
Mutably borrows from an owned value. Read more