pub trait EncodableTo<T> { }Expand description
Marker trait indicating that type E can be encoded from type T.
This trait is used to constrain the Encoder trait and ensure
type safety at compile time. It prevents invalid conversions by
requiring explicit implementation for each valid type pair.
§Purpose
This trait serves as a compile-time guard. Without it, any type
could attempt to encode into any other type, leading to potential
runtime errors. By requiring EncodableTo<T> to be implemented,
the compiler can verify that a conversion is valid before allowing
the Encoder implementation.
§Implementation
This trait has no methods and serves only as a marker. Implement it for destination types that can be encoded from a source type:
use tsumiki::encoder::EncodableTo;
struct MySourceType;
struct MyEncodedType;
// Allow MySourceType to be encoded to MyEncodedType
impl EncodableTo<MySourceType> for MyEncodedType {}