MCPcopy Create free account
hub / github.com/PerroEngine/Perro / DeriveVariant

Interface DeriveVariant

perro_source/core/perro_variant/src/variant.rs:318–327  ·  view source on GitHub ↗

Typed conversion contract used by script state and method parameter conversion. Implement this trait for custom structs/enums (typically via `#[derive(Variant)]`).

Source from the content-addressed store, hash-verified

316///
317/// Implement this trait for custom structs/enums (typically via `#[derive(Variant)]`).
318pub trait DeriveVariant: Sized {
319 fn from_variant(value: &Variant) -> Option<Self>;
320 fn from_owned_variant(value: Variant) -> Option<Self> {
321 Self::from_variant(&value)
322 }
323 fn to_variant(&self) -> Variant;
324 fn into_variant(self) -> Variant {
325 self.to_variant()
326 }
327}
328
329/// Optional compile-time introspection metadata for Variant-derived types.
330///

Callers

nothing calls this directly

Implementers 2

variant.rsperro_source/core/perro_variant/src/va
res_path.rsperro_source/api_modules/perro_resourc

Calls

no outgoing calls

Tested by

no test coverage detected