pub trait TypedExternal: 'static {
const TYPE_NAME: &'static str;
const TYPE_NAME_CSTR: &'static [u8];
const TYPE_ID_CSTR: &'static [u8];
}Expand description
Trait for types that can be stored in an ExternalPtr.
This provides R-visible display and diagnostic identifiers. Runtime type
checking is performed by Any::downcast (Rust’s TypeId), not by comparing
these symbols.
§Type ID vs Type Name
-
TYPE_ID_CSTR: Namespaced identifier used in mismatch diagnostics (stored inprot[0]). Format:"<crate_name>@<crate_version>::<module_path>::<type_name>\0"The crate name, version, and module path distinguish otherwise similar names in error messages. They do not determine compatibility.
-
TYPE_NAME_CSTR: Short display name for the R tag (shown when printing). Just the type identifier for readability.
Required Associated Constants§
Sourceconst TYPE_NAME_CSTR: &'static [u8]
const TYPE_NAME_CSTR: &'static [u8]
The type name as a null-terminated C string (for R tag display)
Sourceconst TYPE_ID_CSTR: &'static [u8]
const TYPE_ID_CSTR: &'static [u8]
Namespaced type ID as a null-terminated C string (for diagnostics).
This should include the module path to prevent ambiguous messages.
Use concat!(module_path!(), "::", stringify!(Type), "\0").as_bytes()
when implementing manually, or use #[derive(ExternalPtr)].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".