bespoke

Package Version Hex Docs

gleam add bespoke@1

Types

Bespoke

SerializableBespoke

Usage

Local / Internal guaranteed uniqueness

import bespoke

pub fn main() -> Nil {
  let id = bespoke.new()
  let id2 = bespoke.new()
  // id and id2 are guaranteed to be unique
}

Shared / External guaranteed* uniqueness

Note: *Guaranteed uniqueness is not guaranteed as psudo-randomness is utilised

import bespoke/serializable as bespoke

pub fn main() -> Nil {
  let key = bespoke.new()
  let stringified = bespoke.serialize(key)

  let assert Ok(parsed) = bespoke.deserialize(stringified)
  assert parsed == key // Will be parsed to be equal to the original key
}

Supported runtimes

RuntimeSupported
Erlang
JavaScript
Deno
Bun

Contributing

PRs are welcome with or without prior discussion.

License

This project is licensed under the Apache License, Version 2.0.

See LICENSE for more information.

Additional information

If you’re unsure about anything, contact me directly via BradBot_1#2042

Further documentation can be found at https://hexdocs.pm/bespoke.

Search Document