mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
event_graph: add gen_id() function
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||
|
||||
pub mod events_queue;
|
||||
pub mod model;
|
||||
pub mod protocol_event;
|
||||
@@ -25,6 +27,10 @@ pub trait EventMsg {
|
||||
fn new() -> Self;
|
||||
}
|
||||
|
||||
pub fn gen_id(len: usize) -> String {
|
||||
thread_rng().sample_iter(&Alphanumeric).take(len).map(char::from).collect()
|
||||
}
|
||||
|
||||
pub fn get_current_time() -> u64 {
|
||||
let start = std::time::SystemTime::now();
|
||||
start
|
||||
|
||||
Reference in New Issue
Block a user