Skip to content

Make FluentMessage::attributes() return ExactSizeIterator #263

Open
@juliancoffee

Description

@juliancoffee

It may be an unusual way of using attributes, but we plan to use them to implement message variation, for example, for NPCs speech in the game.

npc-speech-adventurous =
    .1 = I hope to make my own glider someday.
    .2 = I'd like to go spelunking in a cave when I'm stronger.

And we would like to choose a random message.
To do that we have multiple options.

  1. Collect everything into Vec, which seems like redundancy when attributes are already Vec internally.
  2. Expose the vector directly, which might harm incapsulation a bit
  3. Make .attributes() return ExactSizeIterator, so that we can get the length of it, and then using .skip() taking needed element.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions