Skip to content

Commit cfbd5fa

Browse files
committed
Update rbx-dom dependencies
1 parent 6902eca commit cfbd5fa

File tree

10 files changed

+88
-58
lines changed

10 files changed

+88
-58
lines changed

Cargo.lock

Lines changed: 43 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/lune-roblox/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ rand = "0.8"
2020
thiserror = "1.0"
2121
once_cell = "1.17"
2222

23-
rbx_binary = "0.7.7"
24-
rbx_dom_weak = "2.9.0"
25-
rbx_reflection = "4.7.0"
26-
rbx_reflection_database = "0.2.12"
27-
rbx_xml = "0.13.5"
23+
rbx_binary = "1.0.0"
24+
rbx_dom_weak = "3.0.0"
25+
rbx_reflection = "5.0.0"
26+
rbx_reflection_database = "1.0.0"
27+
rbx_xml = "1.0.0"
2828

2929
lune-utils = { version = "0.1.3", path = "../lune-utils" }

crates/lune-roblox/src/datatypes/conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'lua> DomValueToLua<'lua> for LuaValue<'lua> {
5151
DomValue::Float32(n) => Ok(LuaValue::Number(*n as f64)),
5252
DomValue::String(s) => Ok(LuaValue::String(lua.create_string(s)?)),
5353
DomValue::BinaryString(s) => Ok(LuaValue::String(lua.create_string(s)?)),
54-
DomValue::Content(s) => Ok(LuaValue::String(
54+
DomValue::ContentId(s) => Ok(LuaValue::String(
5555
lua.create_string(AsRef::<str>::as_ref(s))?,
5656
)),
5757

crates/lune-roblox/src/document/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl DocumentKind {
6565
for child_ref in dom.root().children() {
6666
if let Some(child_inst) = dom.get_by_ref(*child_ref) {
6767
has_top_level_child = true;
68-
if class_is_a_service(&child_inst.class).unwrap_or(false) {
68+
if class_is_a_service(child_inst.class).unwrap_or(false) {
6969
has_top_level_service = true;
7070
break;
7171
}

crates/lune-roblox/src/document/postprocessing.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rbx_dom_weak::{
22
types::{Ref as DomRef, VariantType as DomType},
3-
Instance as DomInstance, WeakDom,
3+
ustr, Instance as DomInstance, WeakDom,
44
};
55

66
use crate::shared::instance::class_is_a;
@@ -18,8 +18,8 @@ pub fn postprocess_dom_for_model(dom: &mut WeakDom) {
1818
remove_matching_prop(inst, DomType::UniqueId, "HistoryId");
1919
// Similar story with ScriptGuid - this is used
2020
// in the studio-only cloud script drafts feature
21-
if class_is_a(&inst.class, "LuaSourceContainer").unwrap_or(false) {
22-
inst.properties.remove("ScriptGuid");
21+
if class_is_a(inst.class, "LuaSourceContainer").unwrap_or(false) {
22+
inst.properties.remove(&ustr("ScriptGuid"));
2323
}
2424
});
2525
}
@@ -41,6 +41,7 @@ where
4141
}
4242

4343
fn remove_matching_prop(inst: &mut DomInstance, ty: DomType, name: &'static str) {
44+
let name = &ustr(name);
4445
if inst.properties.get(name).is_some_and(|u| u.ty() == ty) {
4546
inst.properties.remove(name);
4647
}

crates/lune-roblox/src/instance/base.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
7171
"FindFirstAncestorWhichIsA",
7272
|lua, this, class_name: String| {
7373
ensure_not_destroyed(this)?;
74-
this.find_ancestor(|child| class_is_a(&child.class, &class_name).unwrap_or(false))
74+
this.find_ancestor(|child| class_is_a(child.class, &class_name).unwrap_or(false))
7575
.into_lua(lua)
7676
},
7777
);
@@ -104,7 +104,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
104104
|lua, this, (class_name, recursive): (String, Option<bool>)| {
105105
ensure_not_destroyed(this)?;
106106
let predicate =
107-
|child: &DomInstance| class_is_a(&child.class, &class_name).unwrap_or(false);
107+
|child: &DomInstance| class_is_a(child.class, &class_name).unwrap_or(false);
108108
if matches!(recursive, Some(true)) {
109109
this.find_descendant(predicate).into_lua(lua)
110110
} else {
@@ -113,7 +113,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
113113
},
114114
);
115115
m.add_method("IsA", |_, this, class_name: String| {
116-
Ok(class_is_a(&this.class_name, class_name).unwrap_or(false))
116+
Ok(class_is_a(this.class_name, class_name).unwrap_or(false))
117117
});
118118
m.add_method(
119119
"IsAncestorOf",
@@ -230,7 +230,7 @@ fn instance_property_get<'lua>(
230230
return this.get_name().into_lua(lua);
231231
}
232232

233-
if let Some(info) = find_property_info(&this.class_name, &prop_name) {
233+
if let Some(info) = find_property_info(this.class_name, &prop_name) {
234234
if let Some(prop) = this.get_property(&prop_name) {
235235
if let DomValue::Enum(enum_value) = prop {
236236
let enum_name = info.enum_name.ok_or_else(|| {
@@ -275,7 +275,7 @@ fn instance_property_get<'lua>(
275275
} else if let Some(inst) = this.find_child(|inst| inst.name == prop_name) {
276276
Ok(LuaValue::UserData(lua.create_userdata(inst)?))
277277
} else if let Some(getter) = InstanceRegistry::find_property_getter(lua, this, &prop_name) {
278-
getter.call(this.clone())
278+
getter.call(*this)
279279
} else if let Some(method) = InstanceRegistry::find_method(lua, this, &prop_name) {
280280
Ok(LuaValue::Function(method))
281281
} else {
@@ -321,13 +321,13 @@ fn instance_property_set<'lua>(
321321
}
322322
type Parent<'lua> = Option<LuaUserDataRef<'lua, Instance>>;
323323
let parent = Parent::from_lua(prop_value, lua)?;
324-
this.set_parent(parent.map(|p| p.clone()));
324+
this.set_parent(parent.map(|p| *p));
325325
return Ok(());
326326
}
327327
_ => {}
328328
}
329329

330-
if let Some(info) = find_property_info(&this.class_name, &prop_name) {
330+
if let Some(info) = find_property_info(this.class_name, &prop_name) {
331331
if let Some(enum_name) = info.enum_name {
332332
match LuaUserDataRef::<EnumItem>::from_lua(prop_value, lua) {
333333
Ok(given_enum) if given_enum.parent.desc.name == enum_name => {
@@ -354,7 +354,7 @@ fn instance_property_set<'lua>(
354354
)))
355355
}
356356
} else if let Some(setter) = InstanceRegistry::find_property_setter(lua, this, &prop_name) {
357-
setter.call((this.clone(), prop_value))
357+
setter.call((*this, prop_value))
358358
} else {
359359
Err(LuaError::RuntimeError(format!(
360360
"{prop_name} is not a valid member of {this}",

crates/lune-roblox/src/instance/data_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn data_model_get_service(_: &Lua, this: &Instance, service_name: String) -> Lua
4848
Ok(service)
4949
} else {
5050
let service = Instance::new_orphaned(service_name);
51-
service.set_parent(Some(this.clone()));
51+
service.set_parent(Some(*this));
5252
Ok(service)
5353
}
5454
}

0 commit comments

Comments
 (0)