Skip to content

Replace Ambiguous Tuples with Named Structs for Clarity and Type Safety #21

@NGA-TRAN

Description

@NGA-TRAN

The codebase currently overuses raw tuples (e.g., Result<(String, String)>), which negatively impacts readability and makes our intent opaque—both to developers and the compiler.

For example:

Result<(String, String)> // What do these values represent?

This introduces potential bugs from misordered usage and lacks semantic meaning.

Proposed Solution:

  • Define meaningful types in vocab.rs, such as:
struct Host {
    name: String,
    addr: String,
}```

  - Refactor function signatures and return values to use named structs instead of raw tuples
  - Improve IDE/tooling support and code self-documentation in the process

This will make the codebase more intuitive, less error-prone, and easier to evolve over time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions