Skip to content

Rust traits/types representation: encode arbitrary Rust values and type shapes as links #55

@konard

Description

@konard

Context

Issue #47 requires "also Rust traits/types representation" as a storage form.
LinkType::Object and LinkNetwork::insert_object cover identity and
circular references, and lino-objects-codec fixtures are gated, but arbitrary
user structs/enums cannot be encoded to links and decoded back, and Rust type
shapes are not represented. See requirements.md
R-9 and solution-plans.md S-7.

Ecosystem parity target: lino-objects-codec 0.2.1 (Rust) / 0.4.0 (npm) -
object encode/decode with identity and circular-reference preservation
(formats-storage-apis.md Part B).

Blocked by: #05 (the LiNo serializer makes encodings inspectable and
provides the codec's text form).

Scope

  • ToLinks / FromLinks traits with implementations for primitives, Vec,
    Option, maps; decide between a #[derive(Links)] proc-macro and a serde
    Serializer/Deserializer adapter (serde reuses the whole ecosystem at zero
    macro cost) - record the decision and rationale.
  • Preserve shared references and cycles via object-identity links, porting
    lino-objects-codec's shared-reference and circular-reference cases as
    fixtures.
  • Represent Rust type declarations (struct/enum/trait shape) as links using
    the existing self-description roots (type, Type, field) so type shape
    is queryable data.

Acceptance criteria

  • A user struct with nesting, sharing, and a cycle round-trips through
    links and through LiNo text.
  • Type-shape links are queryable via LinkQuery.
  • lino-objects-codec parity fixtures extended to the new codec path.
  • Changelog fragment added (bump: minor).

References


Filed from docs/case-studies/issue-47/proposed-issues/07-rust-types-links-codec.md. Part of the implementation plan for #47.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions