MCPcopy Index your code
hub / github.com/RustPython/RustPython / generate_time_safe

Function generate_time_safe

crates/stdlib/src/uuid.rs:19–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18 #[pyfunction]
19 fn generate_time_safe() -> (Vec<u8>, PyNone) {
20 static CONTEXT: Context = Context::new(0);
21 let ts = Timestamp::now(&CONTEXT);
22
23 static NODE_ID: OnceLock<[u8; 6]> = OnceLock::new();
24 let unique_node_id = NODE_ID.get_or_init(get_node_id);
25
26 (Uuid::new_v1(ts, unique_node_id).as_bytes().to_vec(), PyNone)
27 }
28
29 #[pyattr]
30 fn has_uuid_generate_time_safe(_vm: &VirtualMachine) -> u32 {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
to_vecMethod · 0.80
get_or_initMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected