|
|
@@ -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
|