This commit is contained in:
sxyazi 2024-11-23 18:11:53 +08:00
parent 0dbe509aa1
commit 84eabc42da
No known key found for this signature in database

View file

@ -63,13 +63,7 @@ impl Url {
lua.create_string(me.as_os_str().as_encoded_bytes())
});
reg.add_meta_method(MetaMethod::Concat, |lua, lhs, rhs: mlua::String| {
let me = lhs.as_os_str().as_encoded_bytes();
let other = rhs.as_bytes();
let mut out = Vec::with_capacity(me.len() + other.len());
out.extend_from_slice(me);
out.extend_from_slice(&other);
lua.create_string(out)
lua.create_string([lhs.as_os_str().as_encoded_bytes(), rhs.as_bytes().as_ref()].concat())
});
})
}