CastTo

Trait CastTo 

Source
pub(crate) trait CastTo: 'static {
    type Target: 'static;
}
Expand description

Helper trait to force explicit turbofish syntax on pointer casts.

This trait prevents accidental type inference on calls like ptr.cast::<U>(), ensuring callers explicitly specify the target type. This helps catch bugs where the wrong type might be silently inferred.

The trait’s associated type Target is always equal to Self, but the compiler cannot infer it automatically, requiring explicit specification.

Required Associated Types§

Source

type Target: 'static

Target type of the cast. Always equal to Self, but cannot be inferred by the compiler, forcing explicit turbofish syntax.

Implementors§

Source§

impl<T: 'static> CastTo for T