Skip to content

UUIDBuilder -- should it be a singleton as it is in the other language libs? (e.g. up-java and up-cpp) #58

Closed
@PLeVasseur

Description

@PLeVasseur

Howdy 👋

@stevenhartley recently brought up on a PR going into up-client-zenoh-rust that the other language libs implement their UUID builder / factory as singletons to avoid an end-user accidentally foot-gunning themselves by using multiple UUIDBuilder within one uE.

He asked why the same wasn't done in up-rust. I had my thoughts as to why:

Making it a singleton in Rust forces upon the end user a certain way of interacting with the singleton and there are multiple (reasonable) ways of doing this in Rust. However, maybe it makes sense to give a "simple" path to an end-user not foot-gunning themselves with multiple UUIDBuilder, but allow the possibility for an advanced user to ensure it's a singleton themselves?

A couple of reasonable ways of doing this in Rust:

  • lazy_static
  • once_cell

Looking to hear feedback on this, hopefully from @sophokles73, @AnotherDaniel, and @evshary

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions