Skip to content

Commit 8d7f211

Browse files
committed
use Uuid:::from_u128 for uuid_to_string
1 parent 0e6b377 commit 8d7f211

File tree

1 file changed

+4
-1
lines changed
  • src/serializers/type_serializers

1 file changed

+4
-1
lines changed

src/serializers/type_serializers/uuid.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::borrow::Cow;
22

33
use pyo3::prelude::*;
44
use pyo3::types::PyDict;
5+
use uuid::Uuid;
56

67
use crate::definitions::DefinitionsBuilder;
78

@@ -11,7 +12,9 @@ use super::{
1112
};
1213

1314
pub(crate) fn uuid_to_string(py_uuid: &Bound<'_, PyAny>) -> PyResult<String> {
14-
Ok(py_uuid.str()?.to_string())
15+
let uuid_int_val: u128 = py_uuid.getattr("int")?.extract()?;
16+
let uuid = Uuid::from_u128(uuid_int_val);
17+
Ok(uuid.to_string())
1518
}
1619

1720
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)