rattish-0.6.0 doesn't have any documentation.
RaTTIsh
rattish enables dynamic casting between different trait objects.
This functionality requires runtime type information that isn't automatically created by the Rust compiler and so must be generated manually.
rattish is presently only experimental, and depends on unstable compiler
features including generic_associated_types
, ptr_metadata
and
unsize
; once_cell
is used by DB
(enabled by the global
feature). Accordingly, a nightly toolchain is required.
Example
use ;
use ;
// Casting from an object of trait Foo requires Foo to have
// super-trait Any..
// ..and that Foo implements both Coercible and InnermostTypeId,
// for which there is a macro:
coercible_trait!;
// Casting to an object of trait Bar does not require anything
// special..
;
Extending rattish to additional pointer/wrapper types
You will need to implement Coercible
and InnermostTypeId
for
your type; and also Pointer
if your type is a pointer-type (that
is, if it is Sized + Deref
).