Refactor encoding logic in ChangeBatcher for improved readability and consistency

- Simplified the `isReadable` condition in `encodeService.lua` for better clarity.
- Updated float formatting functions in `json.rs` to enhance precision and consistency in numeric representation.
- Refactored handling of `AmbiguousValue` in `resolution.rs` to eliminate unnecessary type casting, improving data integrity.
- Cleaned up formatting in `serve.rs` and test files for better code readability.

These changes enhance the clarity and efficiency of the encoding and serialization processes, contributing to overall performance improvements.
This commit is contained in:
Joe 2026-02-18 09:47:50 -06:00
parent 3c026aea40
commit 0450dabfce
6 changed files with 47 additions and 51 deletions

View file

@ -151,7 +151,13 @@ fn build_dom_from_chunks(payload: SyncbackPayload) -> anyhow::Result<WeakDom> {
let mut cloned = Vec::new();
for &child_ref in chunk_dom.root().children() {
deep_clone_into(&chunk_dom, &mut dom, child_ref, root_ref, &mut global_ref_map);
deep_clone_into(
&chunk_dom,
&mut dom,
child_ref,
root_ref,
&mut global_ref_map,
);
let new_ref = *global_ref_map.get(&child_ref).unwrap();
cloned.push(new_ref);
}
@ -214,10 +220,9 @@ fn build_dom_from_chunks(payload: SyncbackPayload) -> anyhow::Result<WeakDom> {
for (service_ref, ref_entries) in deferred_refs {
for (prop_name, carrier_ref) in ref_entries {
if let Some(Variant::Ref(actual_target)) =
dom.get_by_ref(carrier_ref).and_then(|inst| {
inst.properties.get(&rbx_dom_weak::ustr("Value")).cloned()
})
if let Some(Variant::Ref(actual_target)) = dom
.get_by_ref(carrier_ref)
.and_then(|inst| inst.properties.get(&rbx_dom_weak::ustr("Value")).cloned())
{
let service = dom.get_by_ref_mut(service_ref).unwrap();
service