use core_ext::convert::To; struct A(u8); impl To for A {} struct B(u8); impl From for B { fn from(value: A) -> Self { Self(value.0 + 1) } } impl To for B {} struct C(u8); impl From for C { fn from(value: B) -> Self { Self(value.0 + 2) } } #[cfg(test)] mod snapshots { use crate::*; #[test] fn test_to() { // inline snapshots, see https://docs.rs/insta/latest/insta/#inline-snapshots insta::assert_yaml_snapshot!(A(1).to::().0, @r###" --- 2 "###); } #[test] fn test_to_chain() { // regular snapshots, see ./snapshots insta::assert_yaml_snapshot!(A(5).to::().to::().0); } }