Skip to content

refactor: Extract shared truncate_str helper from vGPU and MIG renderers #179

Description

@inureyes

Problem / Background

src/ui/renderers/vgpu_renderer.rs and src/ui/renderers/mig_renderer.rs both contain byte-identical private truncate_str functions that truncate a string to a max character count with an ellipsis suffix. This duplication increases maintenance risk -- a bug fix or behavior change in one copy may not be applied to the other.

Goal

Extract the shared truncate_str function into a common module (e.g., src/ui/renderers/mod.rs or a shared src/ui/utils.rs) and have both renderers import it.

Scope

  • Move truncate_str to a shared location
  • Update both vgpu_renderer.rs and mig_renderer.rs to use the shared version
  • Ensure existing tests continue to pass

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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