#id #user-id #generate #generates-random

无std custom_user_id

生成一个随机id,并将其选择的字符串附加或前置到id上

1个不稳定版本

0.0.3 2022年10月15日
0.0.2 2022年10月15日
0.0.1 2022年10月15日

#1029 in WebAssembly

MIT 许可证

4KB

custom_user_id

生成一个随机id,并将其选择的字符串附加或前置到id上。如果您想跨多个设备和平台跟踪用户,这将非常有用。该crate在内部使用uuid,并启用js,因此它可以用于WebAssembly。

使用方法

use custom_user_id::generate_id;

// Set the second argument to true to prepend the id with the given string
generate_id("my_app", true) // my-app-155abb84-81d5-4f36-9220-ef664e785195

// Set second argument to false to append the id with the given string
generate_id("my_app", false) // 7929654a-21a9-4dc5-9ef9-e84a49e393ab-my-app

依赖项

~0.8–1.6MB
~31K SLoC