mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Make Vertex immutable
To match the C++ implementation. I meant to do this at the same time as the other metadata structs but missed it.
This commit is contained in:
+1
-15
@@ -1,5 +1,4 @@
|
||||
use std::{
|
||||
hash::{DefaultHasher, Hash, Hasher},
|
||||
path::PathBuf,
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
@@ -225,7 +224,7 @@ impl From<Arc<RwLock<libloot::Database>>> for Database {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyclass(eq, ord, str = "{0:?}")]
|
||||
#[pyclass(eq, ord, frozen, hash, str = "{0:?}")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[repr(transparent)]
|
||||
pub struct Vertex(libloot::Vertex);
|
||||
@@ -250,13 +249,6 @@ impl Vertex {
|
||||
.transpose()
|
||||
}
|
||||
|
||||
#[setter]
|
||||
fn set_out_edge_type(&mut self, out_edge_type: EdgeType) -> Result<(), VerboseError> {
|
||||
let out_edge_type = out_edge_type.try_into()?;
|
||||
self.0.set_out_edge_type(out_edge_type);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn __repr__(slf: &Bound<'_, Self>) -> PyResult<String> {
|
||||
let class_name = slf.get_type().qualname()?;
|
||||
let inner = &slf.borrow().0;
|
||||
@@ -267,12 +259,6 @@ impl Vertex {
|
||||
inner.out_edge_type().map_or(NONE_REPR, repr_edge_type),
|
||||
))
|
||||
}
|
||||
|
||||
fn __hash__(&self) -> u64 {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
self.0.hash(&mut hasher);
|
||||
hasher.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<libloot::Vertex> for Vertex {
|
||||
|
||||
Reference in New Issue
Block a user