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:
@@ -241,8 +241,14 @@ pub struct Vertex(libloot::Vertex);
|
||||
#[napi]
|
||||
impl Vertex {
|
||||
#[napi(constructor)]
|
||||
pub fn new(name: String) -> Self {
|
||||
Self(libloot::Vertex::new(name))
|
||||
pub fn new(name: String, out_edge_type: Option<EdgeType>) -> Self {
|
||||
let mut vertex = libloot::Vertex::new(name);
|
||||
|
||||
if let Some(out_edge_type) = out_edge_type {
|
||||
vertex = vertex.with_out_edge_type(out_edge_type.into());
|
||||
}
|
||||
|
||||
Self(vertex)
|
||||
}
|
||||
|
||||
#[napi(getter)]
|
||||
@@ -257,12 +263,6 @@ impl Vertex {
|
||||
.map(|e| e.try_into().map_err(Into::into))
|
||||
.transpose()
|
||||
}
|
||||
|
||||
#[napi(setter)]
|
||||
pub fn set_out_edge_type(&mut self, out_edge_type: EdgeType) {
|
||||
let out_edge_type = out_edge_type.into();
|
||||
self.0.set_out_edge_type(out_edge_type);
|
||||
}
|
||||
}
|
||||
|
||||
impl From<libloot::Vertex> for Vertex {
|
||||
|
||||
Reference in New Issue
Block a user