diff --git a/packages/lib-roblox/src/datatypes/conversion.rs b/packages/lib-roblox/src/datatypes/conversion.rs index 51cd3dc..07b91ad 100644 --- a/packages/lib-roblox/src/datatypes/conversion.rs +++ b/packages/lib-roblox/src/datatypes/conversion.rs @@ -1,21 +1,21 @@ use mlua::prelude::*; -use rbx_dom_weak::types::{Variant as RbxVariant, VariantType as RbxVariantType}; +use rbx_dom_weak::types::{Variant as DomValue, VariantType as DomType}; -use crate::datatypes::extension::RbxVariantExt; +use crate::datatypes::extension::DomValueExt; use super::*; -pub(crate) trait LuaToRbxVariant<'lua> { - fn lua_to_rbx_variant( +pub(crate) trait LuaToDomValue<'lua> { + fn lua_to_dom_value( &self, lua: &'lua Lua, - variant_type: RbxVariantType, - ) -> DatatypeConversionResult; + variant_type: DomType, + ) -> DomConversionResult; } -pub(crate) trait RbxVariantToLua<'lua>: Sized { - fn rbx_variant_to_lua(lua: &'lua Lua, variant: &RbxVariant) -> DatatypeConversionResult; +pub(crate) trait DomValueToLua<'lua>: Sized { + fn dom_value_to_lua(lua: &'lua Lua, variant: &DomValue) -> DomConversionResult; } /* @@ -28,27 +28,26 @@ pub(crate) trait RbxVariantToLua<'lua>: Sized { */ -impl<'lua> RbxVariantToLua<'lua> for LuaValue<'lua> { - fn rbx_variant_to_lua(lua: &'lua Lua, variant: &RbxVariant) -> DatatypeConversionResult { +impl<'lua> DomValueToLua<'lua> for LuaValue<'lua> { + fn dom_value_to_lua(lua: &'lua Lua, variant: &DomValue) -> DomConversionResult { use base64::engine::general_purpose::STANDARD_NO_PAD; use base64::engine::Engine as _; - use rbx_dom_weak::types as rbx; - use RbxVariant as Rbx; + use rbx_dom_weak::types as dom; - match LuaAnyUserData::rbx_variant_to_lua(lua, variant) { + match LuaAnyUserData::dom_value_to_lua(lua, variant) { Ok(value) => Ok(LuaValue::UserData(value)), Err(e) => match variant { - Rbx::Bool(b) => Ok(LuaValue::Boolean(*b)), - Rbx::Int64(i) => Ok(LuaValue::Number(*i as f64)), - Rbx::Int32(i) => Ok(LuaValue::Number(*i as f64)), - Rbx::Float64(n) => Ok(LuaValue::Number(*n)), - Rbx::Float32(n) => Ok(LuaValue::Number(*n as f64)), - Rbx::String(s) => Ok(LuaValue::String(lua.create_string(s)?)), - Rbx::Content(s) => Ok(LuaValue::String( + DomValue::Bool(b) => Ok(LuaValue::Boolean(*b)), + DomValue::Int64(i) => Ok(LuaValue::Number(*i as f64)), + DomValue::Int32(i) => Ok(LuaValue::Number(*i as f64)), + DomValue::Float64(n) => Ok(LuaValue::Number(*n)), + DomValue::Float32(n) => Ok(LuaValue::Number(*n as f64)), + DomValue::String(s) => Ok(LuaValue::String(lua.create_string(s)?)), + DomValue::Content(s) => Ok(LuaValue::String( lua.create_string(AsRef::::as_ref(s))?, )), - Rbx::BinaryString(s) => { + DomValue::BinaryString(s) => { let encoded = STANDARD_NO_PAD.encode(AsRef::<[u8]>::as_ref(s)); Ok(LuaValue::String(lua.create_string(&encoded)?)) } @@ -56,7 +55,7 @@ impl<'lua> RbxVariantToLua<'lua> for LuaValue<'lua> { // NOTE: We need this special case here to handle default (nil) // physical properties since our PhysicalProperties datatype // implementation does not handle default at all, only custom - Rbx::PhysicalProperties(rbx::PhysicalProperties::Default) => Ok(LuaValue::Nil), + DomValue::PhysicalProperties(dom::PhysicalProperties::Default) => Ok(LuaValue::Nil), _ => Err(e), }, @@ -64,50 +63,48 @@ impl<'lua> RbxVariantToLua<'lua> for LuaValue<'lua> { } } -impl<'lua> LuaToRbxVariant<'lua> for LuaValue<'lua> { - fn lua_to_rbx_variant( +impl<'lua> LuaToDomValue<'lua> for LuaValue<'lua> { + fn lua_to_dom_value( &self, lua: &'lua Lua, - variant_type: RbxVariantType, - ) -> DatatypeConversionResult { + variant_type: DomType, + ) -> DomConversionResult { use base64::engine::general_purpose::STANDARD_NO_PAD; use base64::engine::Engine as _; - use rbx_dom_weak::types as rbx; - use RbxVariant as Rbx; - use RbxVariantType as RbxType; + use rbx_dom_weak::types as dom; match (self, variant_type) { - (LuaValue::Boolean(b), RbxType::Bool) => Ok(Rbx::Bool(*b)), + (LuaValue::Boolean(b), DomType::Bool) => Ok(DomValue::Bool(*b)), - (LuaValue::Integer(i), RbxType::Int64) => Ok(Rbx::Int64(*i as i64)), - (LuaValue::Integer(i), RbxType::Int32) => Ok(Rbx::Int32(*i)), - (LuaValue::Integer(i), RbxType::Float64) => Ok(Rbx::Float64(*i as f64)), - (LuaValue::Integer(i), RbxType::Float32) => Ok(Rbx::Float32(*i as f32)), + (LuaValue::Integer(i), DomType::Int64) => Ok(DomValue::Int64(*i as i64)), + (LuaValue::Integer(i), DomType::Int32) => Ok(DomValue::Int32(*i)), + (LuaValue::Integer(i), DomType::Float64) => Ok(DomValue::Float64(*i as f64)), + (LuaValue::Integer(i), DomType::Float32) => Ok(DomValue::Float32(*i as f32)), - (LuaValue::Number(n), RbxType::Int64) => Ok(Rbx::Int64(*n as i64)), - (LuaValue::Number(n), RbxType::Int32) => Ok(Rbx::Int32(*n as i32)), - (LuaValue::Number(n), RbxType::Float64) => Ok(Rbx::Float64(*n)), - (LuaValue::Number(n), RbxType::Float32) => Ok(Rbx::Float32(*n as f32)), + (LuaValue::Number(n), DomType::Int64) => Ok(DomValue::Int64(*n as i64)), + (LuaValue::Number(n), DomType::Int32) => Ok(DomValue::Int32(*n as i32)), + (LuaValue::Number(n), DomType::Float64) => Ok(DomValue::Float64(*n)), + (LuaValue::Number(n), DomType::Float32) => Ok(DomValue::Float32(*n as f32)), - (LuaValue::String(s), RbxType::String) => Ok(Rbx::String(s.to_str()?.to_string())), - (LuaValue::String(s), RbxType::Content) => { - Ok(Rbx::Content(s.to_str()?.to_string().into())) + (LuaValue::String(s), DomType::String) => Ok(DomValue::String(s.to_str()?.to_string())), + (LuaValue::String(s), DomType::Content) => { + Ok(DomValue::Content(s.to_str()?.to_string().into())) } - (LuaValue::String(s), RbxType::BinaryString) => { - Ok(Rbx::BinaryString(STANDARD_NO_PAD.decode(s)?.into())) + (LuaValue::String(s), DomType::BinaryString) => { + Ok(DomValue::BinaryString(STANDARD_NO_PAD.decode(s)?.into())) } // NOTE: We need this special case here to handle default (nil) // physical properties since our PhysicalProperties datatype // implementation does not handle default at all, only custom - (LuaValue::Nil, RbxType::PhysicalProperties) => { - Ok(Rbx::PhysicalProperties(rbx::PhysicalProperties::Default)) - } + (LuaValue::Nil, DomType::PhysicalProperties) => Ok(DomValue::PhysicalProperties( + dom::PhysicalProperties::Default, + )), - (LuaValue::UserData(u), d) => u.lua_to_rbx_variant(lua, d), + (LuaValue::UserData(u), d) => u.lua_to_dom_value(lua, d), - (v, d) => Err(DatatypeConversionError::ToRbxVariant { + (v, d) => Err(DomConversionError::ToDomValue { to: d.variant_name(), from: v.type_name(), detail: None, @@ -126,13 +123,12 @@ impl<'lua> LuaToRbxVariant<'lua> for LuaValue<'lua> { */ -impl<'lua> RbxVariantToLua<'lua> for LuaAnyUserData<'lua> { +impl<'lua> DomValueToLua<'lua> for LuaAnyUserData<'lua> { #[rustfmt::skip] - fn rbx_variant_to_lua(lua: &'lua Lua, variant: &RbxVariant) -> DatatypeConversionResult { + fn dom_value_to_lua(lua: &'lua Lua, variant: &DomValue) -> DomConversionResult { use super::types::*; - use rbx_dom_weak::types as rbx; - use RbxVariant as Rbx; + use rbx_dom_weak::types as dom; /* NOTES: @@ -147,45 +143,45 @@ impl<'lua> RbxVariantToLua<'lua> for LuaAnyUserData<'lua> { */ Ok(match variant.clone() { - Rbx::Axes(value) => lua.create_userdata(Axes::from(value))?, - Rbx::Faces(value) => lua.create_userdata(Faces::from(value))?, + DomValue::Axes(value) => lua.create_userdata(Axes::from(value))?, + DomValue::Faces(value) => lua.create_userdata(Faces::from(value))?, - Rbx::CFrame(value) => lua.create_userdata(CFrame::from(value))?, + DomValue::CFrame(value) => lua.create_userdata(CFrame::from(value))?, - Rbx::BrickColor(value) => lua.create_userdata(BrickColor::from(value))?, - Rbx::Color3(value) => lua.create_userdata(Color3::from(value))?, - Rbx::Color3uint8(value) => lua.create_userdata(Color3::from(value))?, - Rbx::ColorSequence(value) => lua.create_userdata(ColorSequence::from(value))?, + DomValue::BrickColor(value) => lua.create_userdata(BrickColor::from(value))?, + DomValue::Color3(value) => lua.create_userdata(Color3::from(value))?, + DomValue::Color3uint8(value) => lua.create_userdata(Color3::from(value))?, + DomValue::ColorSequence(value) => lua.create_userdata(ColorSequence::from(value))?, - Rbx::Font(value) => lua.create_userdata(Font::from(value))?, + DomValue::Font(value) => lua.create_userdata(Font::from(value))?, - Rbx::NumberRange(value) => lua.create_userdata(NumberRange::from(value))?, - Rbx::NumberSequence(value) => lua.create_userdata(NumberSequence::from(value))?, + DomValue::NumberRange(value) => lua.create_userdata(NumberRange::from(value))?, + DomValue::NumberSequence(value) => lua.create_userdata(NumberSequence::from(value))?, - Rbx::Ray(value) => lua.create_userdata(Ray::from(value))?, + DomValue::Ray(value) => lua.create_userdata(Ray::from(value))?, - Rbx::Rect(value) => lua.create_userdata(Rect::from(value))?, - Rbx::UDim(value) => lua.create_userdata(UDim::from(value))?, - Rbx::UDim2(value) => lua.create_userdata(UDim2::from(value))?, + DomValue::Rect(value) => lua.create_userdata(Rect::from(value))?, + DomValue::UDim(value) => lua.create_userdata(UDim::from(value))?, + DomValue::UDim2(value) => lua.create_userdata(UDim2::from(value))?, - Rbx::Region3(value) => lua.create_userdata(Region3::from(value))?, - Rbx::Region3int16(value) => lua.create_userdata(Region3int16::from(value))?, - Rbx::Vector2(value) => lua.create_userdata(Vector2::from(value))?, - Rbx::Vector2int16(value) => lua.create_userdata(Vector2int16::from(value))?, - Rbx::Vector3(value) => lua.create_userdata(Vector3::from(value))?, - Rbx::Vector3int16(value) => lua.create_userdata(Vector3int16::from(value))?, + DomValue::Region3(value) => lua.create_userdata(Region3::from(value))?, + DomValue::Region3int16(value) => lua.create_userdata(Region3int16::from(value))?, + DomValue::Vector2(value) => lua.create_userdata(Vector2::from(value))?, + DomValue::Vector2int16(value) => lua.create_userdata(Vector2int16::from(value))?, + DomValue::Vector3(value) => lua.create_userdata(Vector3::from(value))?, + DomValue::Vector3int16(value) => lua.create_userdata(Vector3int16::from(value))?, - Rbx::OptionalCFrame(value) => match value { + DomValue::OptionalCFrame(value) => match value { Some(value) => lua.create_userdata(CFrame::from(value))?, None => lua.create_userdata(CFrame::IDENTITY)? }, - Rbx::PhysicalProperties(rbx::PhysicalProperties::Custom(value)) => { + DomValue::PhysicalProperties(dom::PhysicalProperties::Custom(value)) => { lua.create_userdata(PhysicalProperties::from(value))? }, v => { - return Err(DatatypeConversionError::FromRbxVariant { + return Err(DomConversionError::FromDomValue { from: v.variant_name(), to: "userdata", detail: Some("Type not supported".to_string()), @@ -195,63 +191,63 @@ impl<'lua> RbxVariantToLua<'lua> for LuaAnyUserData<'lua> { } } -impl<'lua> LuaToRbxVariant<'lua> for LuaAnyUserData<'lua> { +impl<'lua> LuaToDomValue<'lua> for LuaAnyUserData<'lua> { #[rustfmt::skip] - fn lua_to_rbx_variant( + fn lua_to_dom_value( &self, _: &'lua Lua, - variant_type: RbxVariantType, - ) -> DatatypeConversionResult { + variant_type: DomType, + ) -> DomConversionResult { use super::types::*; - use rbx_dom_weak::types as rbx; + use rbx_dom_weak::types as dom; let f = match variant_type { - RbxVariantType::Axes => convert::, - RbxVariantType::Faces => convert::, + DomType::Axes => convert::, + DomType::Faces => convert::, - RbxVariantType::CFrame => convert::, + DomType::CFrame => convert::, - RbxVariantType::BrickColor => convert::, - RbxVariantType::Color3 => convert::, - RbxVariantType::Color3uint8 => convert::, - RbxVariantType::ColorSequence => convert::, + DomType::BrickColor => convert::, + DomType::Color3 => convert::, + DomType::Color3uint8 => convert::, + DomType::ColorSequence => convert::, - RbxVariantType::Enum => convert::, + DomType::Enum => convert::, - RbxVariantType::Font => convert::, + DomType::Font => convert::, - RbxVariantType::NumberRange => convert::, - RbxVariantType::NumberSequence => convert::, + DomType::NumberRange => convert::, + DomType::NumberSequence => convert::, - RbxVariantType::Rect => convert::, - RbxVariantType::UDim => convert::, - RbxVariantType::UDim2 => convert::, + DomType::Rect => convert::, + DomType::UDim => convert::, + DomType::UDim2 => convert::, - RbxVariantType::Ray => convert::, + DomType::Ray => convert::, - RbxVariantType::Region3 => convert::, - RbxVariantType::Region3int16 => convert::, - RbxVariantType::Vector2 => convert::, - RbxVariantType::Vector2int16 => convert::, - RbxVariantType::Vector3 => convert::, - RbxVariantType::Vector3int16 => convert::, + DomType::Region3 => convert::, + DomType::Region3int16 => convert::, + DomType::Vector2 => convert::, + DomType::Vector2int16 => convert::, + DomType::Vector3 => convert::, + DomType::Vector3int16 => convert::, - RbxVariantType::OptionalCFrame => return match self.borrow::() { - Ok(value) => Ok(RbxVariant::OptionalCFrame(Some(rbx::CFrame::from(*value)))), + DomType::OptionalCFrame => return match self.borrow::() { + Ok(value) => Ok(DomValue::OptionalCFrame(Some(dom::CFrame::from(*value)))), Err(e) => Err(lua_userdata_error_to_conversion_error(variant_type, e)), }, - RbxVariantType::PhysicalProperties => return match self.borrow::() { + DomType::PhysicalProperties => return match self.borrow::() { Ok(value) => { - let props = rbx::CustomPhysicalProperties::from(*value); - let custom = rbx::PhysicalProperties::Custom(props); - Ok(RbxVariant::PhysicalProperties(custom)) + let props = dom::CustomPhysicalProperties::from(*value); + let custom = dom::PhysicalProperties::Custom(props); + Ok(DomValue::PhysicalProperties(custom)) }, Err(e) => Err(lua_userdata_error_to_conversion_error(variant_type, e)), }, - _ => return Err(DatatypeConversionError::ToRbxVariant { + _ => return Err(DomConversionError::ToDomValue { to: variant_type.variant_name(), from: "userdata", detail: Some("Type not supported".to_string()), @@ -262,31 +258,31 @@ impl<'lua> LuaToRbxVariant<'lua> for LuaAnyUserData<'lua> { } } -fn convert( +fn convert( userdata: &LuaAnyUserData, - variant_type: RbxVariantType, -) -> DatatypeConversionResult + variant_type: DomType, +) -> DomConversionResult where - Datatype: LuaUserData + Clone + 'static, - RbxType: From + Into, + TypeFrom: LuaUserData + Clone + 'static, + TypeTo: From + Into, { - match userdata.borrow::() { - Ok(value) => Ok(RbxType::from(value.clone()).into()), + match userdata.borrow::() { + Ok(value) => Ok(TypeTo::from(value.clone()).into()), Err(e) => Err(lua_userdata_error_to_conversion_error(variant_type, e)), } } fn lua_userdata_error_to_conversion_error( - variant_type: RbxVariantType, + variant_type: DomType, error: LuaError, -) -> DatatypeConversionError { +) -> DomConversionError { match error { - LuaError::UserDataTypeMismatch => DatatypeConversionError::ToRbxVariant { + LuaError::UserDataTypeMismatch => DomConversionError::ToDomValue { to: variant_type.variant_name(), from: "userdata", detail: Some("Type mismatch".to_string()), }, - e => DatatypeConversionError::ToRbxVariant { + e => DomConversionError::ToDomValue { to: variant_type.variant_name(), from: "userdata", detail: Some(format!("Internal error: {e}")), diff --git a/packages/lib-roblox/src/datatypes/extension.rs b/packages/lib-roblox/src/datatypes/extension.rs index c2f16e0..ed66a3a 100644 --- a/packages/lib-roblox/src/datatypes/extension.rs +++ b/packages/lib-roblox/src/datatypes/extension.rs @@ -1,12 +1,12 @@ use super::*; -pub(super) trait RbxVariantExt { +pub(super) trait DomValueExt { fn variant_name(&self) -> &'static str; } -impl RbxVariantExt for RbxVariantType { +impl DomValueExt for DomType { fn variant_name(&self) -> &'static str { - use RbxVariantType::*; + use DomType::*; match self { Axes => "Axes", BinaryString => "BinaryString", @@ -45,7 +45,7 @@ impl RbxVariantExt for RbxVariantType { } } -impl RbxVariantExt for RbxVariant { +impl DomValueExt for DomValue { fn variant_name(&self) -> &'static str { self.ty().variant_name() } diff --git a/packages/lib-roblox/src/datatypes/mod.rs b/packages/lib-roblox/src/datatypes/mod.rs index e9d613d..9381c53 100644 --- a/packages/lib-roblox/src/datatypes/mod.rs +++ b/packages/lib-roblox/src/datatypes/mod.rs @@ -1,4 +1,4 @@ -pub(crate) use rbx_dom_weak::types::{Variant as RbxVariant, VariantType as RbxVariantType}; +pub(crate) use rbx_dom_weak::types::{Variant as DomValue, VariantType as DomType}; mod conversion; mod extension; diff --git a/packages/lib-roblox/src/datatypes/result.rs b/packages/lib-roblox/src/datatypes/result.rs index 380ac4b..036f6fb 100644 --- a/packages/lib-roblox/src/datatypes/result.rs +++ b/packages/lib-roblox/src/datatypes/result.rs @@ -7,24 +7,24 @@ use mlua::Error as LuaError; #[allow(dead_code)] #[derive(Clone, Debug)] -pub(crate) enum DatatypeConversionError { +pub(crate) enum DomConversionError { LuaError(LuaError), External { message: String, }, - FromRbxVariant { + FromDomValue { from: &'static str, to: &'static str, detail: Option, }, - ToRbxVariant { + ToDomValue { to: &'static str, from: &'static str, detail: Option, }, } -impl fmt::Display for DatatypeConversionError { +impl fmt::Display for DomConversionError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, @@ -32,8 +32,7 @@ impl fmt::Display for DatatypeConversionError { match self { Self::LuaError(error) => error.to_string(), Self::External { message } => message.to_string(), - Self::FromRbxVariant { from, to, detail } - | Self::ToRbxVariant { from, to, detail } => { + Self::FromDomValue { from, to, detail } | Self::ToDomValue { from, to, detail } => { match detail { Some(d) => format!("Failed to convert from '{from}' into '{to}' - {d}"), None => format!("Failed to convert from '{from}' into '{to}'",), @@ -44,28 +43,28 @@ impl fmt::Display for DatatypeConversionError { } } -impl Error for DatatypeConversionError {} +impl Error for DomConversionError {} -impl From for DatatypeConversionError { +impl From for DomConversionError { fn from(value: LuaError) -> Self { Self::LuaError(value) } } -impl From for DatatypeConversionError { +impl From for DomConversionError { fn from(value: IoError) -> Self { - DatatypeConversionError::External { + DomConversionError::External { message: value.to_string(), } } } -impl From for DatatypeConversionError { +impl From for DomConversionError { fn from(value: base64::DecodeError) -> Self { - DatatypeConversionError::External { + DomConversionError::External { message: value.to_string(), } } } -pub(crate) type DatatypeConversionResult = Result; +pub(crate) type DomConversionResult = Result; diff --git a/packages/lib-roblox/src/datatypes/types/axes.rs b/packages/lib-roblox/src/datatypes/types/axes.rs index 111c8d9..74d9ba3 100644 --- a/packages/lib-roblox/src/datatypes/types/axes.rs +++ b/packages/lib-roblox/src/datatypes/types/axes.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::Axes as RbxAxes; +use rbx_dom_weak::types::Axes as DomAxes; use super::{super::*, EnumItem}; @@ -96,8 +96,8 @@ impl fmt::Display for Axes { } } -impl From for Axes { - fn from(v: RbxAxes) -> Self { +impl From for Axes { + fn from(v: DomAxes) -> Self { let bits = v.bits(); Self { x: (bits & 1) == 1, @@ -107,12 +107,12 @@ impl From for Axes { } } -impl From for RbxAxes { +impl From for DomAxes { fn from(v: Axes) -> Self { let mut bits = 0; bits += v.x as u8; bits += (v.y as u8) << 1; bits += (v.z as u8) << 2; - RbxAxes::from_bits(bits).expect("Invalid bits") + DomAxes::from_bits(bits).expect("Invalid bits") } } diff --git a/packages/lib-roblox/src/datatypes/types/brick_color.rs b/packages/lib-roblox/src/datatypes/types/brick_color.rs index c4859fe..66d2def 100644 --- a/packages/lib-roblox/src/datatypes/types/brick_color.rs +++ b/packages/lib-roblox/src/datatypes/types/brick_color.rs @@ -2,7 +2,7 @@ use core::fmt; use mlua::prelude::*; use rand::seq::SliceRandom; -use rbx_dom_weak::types::BrickColor as RbxBrickColor; +use rbx_dom_weak::types::BrickColor as DomBrickColor; use super::{super::*, Color3}; @@ -13,7 +13,7 @@ use super::{super::*, Color3}; */ #[derive(Debug, Clone, Copy, PartialEq)] pub struct BrickColor { - // Unfortunately we can't use RbxBrickColor as the backing type here + // Unfortunately we can't use DomBrickColor as the backing type here // because it does not expose any way of getting the actual rgb colors :-( pub(crate) number: u16, pub(crate) name: &'static str, @@ -124,15 +124,15 @@ impl From for Color3 { } } -impl From for BrickColor { - fn from(v: RbxBrickColor) -> Self { +impl From for BrickColor { + fn from(v: DomBrickColor) -> Self { color_from_name(v.to_string()) } } -impl From for RbxBrickColor { +impl From for DomBrickColor { fn from(v: BrickColor) -> Self { - RbxBrickColor::from_number(v.number).unwrap_or(RbxBrickColor::MediumStoneGrey) + DomBrickColor::from_number(v.number).unwrap_or(DomBrickColor::MediumStoneGrey) } } diff --git a/packages/lib-roblox/src/datatypes/types/cframe.rs b/packages/lib-roblox/src/datatypes/types/cframe.rs index e2bf880..1601b9b 100644 --- a/packages/lib-roblox/src/datatypes/types/cframe.rs +++ b/packages/lib-roblox/src/datatypes/types/cframe.rs @@ -3,7 +3,7 @@ use std::ops; use glam::{EulerRot, Mat4, Quat, Vec3}; use mlua::prelude::*; -use rbx_dom_weak::types::{CFrame as RbxCFrame, Matrix3 as RbxMatrix3, Vector3 as RbxVector3}; +use rbx_dom_weak::types::{CFrame as DomCFrame, Matrix3 as DomMatrix3, Vector3 as DomVector3}; use super::{super::*, Vector3}; @@ -305,8 +305,8 @@ impl ops::Sub for CFrame { } } -impl From for CFrame { - fn from(v: RbxCFrame) -> Self { +impl From for CFrame { + fn from(v: DomCFrame) -> Self { CFrame(Mat4::from_cols( Vector3::from(v.orientation.x).0.extend(0.0), Vector3::from(v.orientation.y).0.extend(0.0), @@ -316,15 +316,15 @@ impl From for CFrame { } } -impl From for RbxCFrame { +impl From for DomCFrame { fn from(v: CFrame) -> Self { let (rx, ry, rz) = v.orientation(); - RbxCFrame { - position: RbxVector3::from(Vector3(v.position())), - orientation: RbxMatrix3::new( - RbxVector3::from(Vector3(rx)), - RbxVector3::from(Vector3(ry)), - RbxVector3::from(Vector3(rz)), + DomCFrame { + position: DomVector3::from(Vector3(v.position())), + orientation: DomMatrix3::new( + DomVector3::from(Vector3(rx)), + DomVector3::from(Vector3(ry)), + DomVector3::from(Vector3(rz)), ), } } diff --git a/packages/lib-roblox/src/datatypes/types/color3.rs b/packages/lib-roblox/src/datatypes/types/color3.rs index e558c96..26a84e8 100644 --- a/packages/lib-roblox/src/datatypes/types/color3.rs +++ b/packages/lib-roblox/src/datatypes/types/color3.rs @@ -3,7 +3,7 @@ use std::ops; use glam::Vec3; use mlua::prelude::*; -use rbx_dom_weak::types::{Color3 as RbxColor3, Color3uint8 as RbxColor3uint8}; +use rbx_dom_weak::types::{Color3 as DomColor3, Color3uint8 as DomColor3uint8}; use super::super::*; @@ -261,8 +261,8 @@ impl ops::Div for Color3 { } } -impl From for Color3 { - fn from(v: RbxColor3) -> Self { +impl From for Color3 { + fn from(v: DomColor3) -> Self { Self { r: v.r, g: v.g, @@ -271,7 +271,7 @@ impl From for Color3 { } } -impl From for RbxColor3 { +impl From for DomColor3 { fn from(v: Color3) -> Self { Self { r: v.r, @@ -281,8 +281,8 @@ impl From for RbxColor3 { } } -impl From for Color3 { - fn from(v: RbxColor3uint8) -> Self { +impl From for Color3 { + fn from(v: DomColor3uint8) -> Self { Self { r: (v.r as f32) / 255f32, g: (v.g as f32) / 255f32, @@ -291,7 +291,7 @@ impl From for Color3 { } } -impl From for RbxColor3uint8 { +impl From for DomColor3uint8 { fn from(v: Color3) -> Self { Self { r: v.r.clamp(u8::MIN as f32, u8::MAX as f32) as u8, diff --git a/packages/lib-roblox/src/datatypes/types/color_sequence.rs b/packages/lib-roblox/src/datatypes/types/color_sequence.rs index f7e4fdc..97f058a 100644 --- a/packages/lib-roblox/src/datatypes/types/color_sequence.rs +++ b/packages/lib-roblox/src/datatypes/types/color_sequence.rs @@ -2,7 +2,7 @@ use core::fmt; use mlua::prelude::*; use rbx_dom_weak::types::{ - ColorSequence as RbxColorSequence, ColorSequenceKeypoint as RbxColorSequenceKeypoint, + ColorSequence as DomColorSequence, ColorSequenceKeypoint as DomColorSequenceKeypoint, }; use super::{super::*, Color3, ColorSequenceKeypoint}; @@ -82,8 +82,8 @@ impl fmt::Display for ColorSequence { } } -impl From for ColorSequence { - fn from(v: RbxColorSequence) -> Self { +impl From for ColorSequence { + fn from(v: DomColorSequence) -> Self { Self { keypoints: v .keypoints @@ -95,14 +95,14 @@ impl From for ColorSequence { } } -impl From for RbxColorSequence { +impl From for DomColorSequence { fn from(v: ColorSequence) -> Self { Self { keypoints: v .keypoints .iter() .cloned() - .map(RbxColorSequenceKeypoint::from) + .map(DomColorSequenceKeypoint::from) .collect(), } } diff --git a/packages/lib-roblox/src/datatypes/types/color_sequence_keypoint.rs b/packages/lib-roblox/src/datatypes/types/color_sequence_keypoint.rs index 1bd84d6..c8ec640 100644 --- a/packages/lib-roblox/src/datatypes/types/color_sequence_keypoint.rs +++ b/packages/lib-roblox/src/datatypes/types/color_sequence_keypoint.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::ColorSequenceKeypoint as RbxColorSequenceKeypoint; +use rbx_dom_weak::types::ColorSequenceKeypoint as DomColorSequenceKeypoint; use super::{super::*, Color3}; @@ -46,8 +46,8 @@ impl fmt::Display for ColorSequenceKeypoint { } } -impl From for ColorSequenceKeypoint { - fn from(v: RbxColorSequenceKeypoint) -> Self { +impl From for ColorSequenceKeypoint { + fn from(v: DomColorSequenceKeypoint) -> Self { Self { time: v.time, color: v.color.into(), @@ -55,7 +55,7 @@ impl From for ColorSequenceKeypoint { } } -impl From for RbxColorSequenceKeypoint { +impl From for DomColorSequenceKeypoint { fn from(v: ColorSequenceKeypoint) -> Self { Self { time: v.time, diff --git a/packages/lib-roblox/src/datatypes/types/enum_item.rs b/packages/lib-roblox/src/datatypes/types/enum_item.rs index 1ea8a50..68ce7ab 100644 --- a/packages/lib-roblox/src/datatypes/types/enum_item.rs +++ b/packages/lib-roblox/src/datatypes/types/enum_item.rs @@ -1,8 +1,8 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::Enum as RbxEnum; -use rbx_reflection::DataType as RbxDataType; +use rbx_dom_weak::types::Enum as DomEnum; +use rbx_reflection::DataType as DomDataType; use super::{super::*, Enum}; @@ -64,7 +64,7 @@ impl EnumItem { .properties .get(prop_name.as_ref())?; let prop_enum = match &prop.data_type { - RbxDataType::Enum(name) => db.enums.get(name.as_ref()), + DomDataType::Enum(name) => db.enums.get(name.as_ref()), _ => None, }?; let enum_name = prop_enum.items.iter().find_map(|(name, v)| { @@ -107,8 +107,8 @@ impl PartialEq for EnumItem { } } -impl From for RbxEnum { +impl From for DomEnum { fn from(v: EnumItem) -> Self { - RbxEnum::from_u32(v.value) + DomEnum::from_u32(v.value) } } diff --git a/packages/lib-roblox/src/datatypes/types/faces.rs b/packages/lib-roblox/src/datatypes/types/faces.rs index d4a8542..f21e248 100644 --- a/packages/lib-roblox/src/datatypes/types/faces.rs +++ b/packages/lib-roblox/src/datatypes/types/faces.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::Faces as RbxFaces; +use rbx_dom_weak::types::Faces as DomFaces; use super::{super::*, EnumItem}; @@ -105,8 +105,8 @@ impl fmt::Display for Faces { } } -impl From for Faces { - fn from(v: RbxFaces) -> Self { +impl From for Faces { + fn from(v: DomFaces) -> Self { let bits = v.bits(); Self { right: (bits & 1) == 1, @@ -119,7 +119,7 @@ impl From for Faces { } } -impl From for RbxFaces { +impl From for DomFaces { fn from(v: Faces) -> Self { let mut bits = 0; bits += v.right as u8; @@ -128,6 +128,6 @@ impl From for RbxFaces { bits += (v.left as u8) << 3; bits += (v.bottom as u8) << 4; bits += (v.front as u8) << 5; - RbxFaces::from_bits(bits).expect("Invalid bits") + DomFaces::from_bits(bits).expect("Invalid bits") } } diff --git a/packages/lib-roblox/src/datatypes/types/font.rs b/packages/lib-roblox/src/datatypes/types/font.rs index 651bc9d..2bf035a 100644 --- a/packages/lib-roblox/src/datatypes/types/font.rs +++ b/packages/lib-roblox/src/datatypes/types/font.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use mlua::prelude::*; use rbx_dom_weak::types::{ - Font as RbxFont, FontStyle as RbxFontStyle, FontWeight as RbxFontWeight, + Font as DomFont, FontStyle as DomFontStyle, FontWeight as DomFontWeight, }; use super::{super::*, EnumItem}; @@ -135,8 +135,8 @@ impl fmt::Display for Font { } } -impl From for Font { - fn from(v: RbxFont) -> Self { +impl From for Font { + fn from(v: DomFont) -> Self { Self { family: v.family, weight: v.weight.into(), @@ -146,9 +146,9 @@ impl From for Font { } } -impl From for RbxFont { +impl From for DomFont { fn from(v: Font) -> Self { - RbxFont { + DomFont { family: v.family, weight: v.weight.into(), style: v.style.into(), @@ -157,27 +157,27 @@ impl From for RbxFont { } } -impl From for FontWeight { - fn from(v: RbxFontWeight) -> Self { +impl From for FontWeight { + fn from(v: DomFontWeight) -> Self { FontWeight::from_u16(v.as_u16()).expect("Missing font weight") } } -impl From for RbxFontWeight { +impl From for DomFontWeight { fn from(v: FontWeight) -> Self { - RbxFontWeight::from_u16(v.as_u16()).expect("Missing rbx font weight") + DomFontWeight::from_u16(v.as_u16()).expect("Missing rbx font weight") } } -impl From for FontStyle { - fn from(v: RbxFontStyle) -> Self { +impl From for FontStyle { + fn from(v: DomFontStyle) -> Self { FontStyle::from_u8(v.as_u8()).expect("Missing font weight") } } -impl From for RbxFontStyle { +impl From for DomFontStyle { fn from(v: FontStyle) -> Self { - RbxFontStyle::from_u8(v.as_u8()).expect("Missing rbx font weight") + DomFontStyle::from_u8(v.as_u8()).expect("Missing rbx font weight") } } diff --git a/packages/lib-roblox/src/datatypes/types/number_range.rs b/packages/lib-roblox/src/datatypes/types/number_range.rs index b54935c..065097d 100644 --- a/packages/lib-roblox/src/datatypes/types/number_range.rs +++ b/packages/lib-roblox/src/datatypes/types/number_range.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::NumberRange as RbxNumberRange; +use rbx_dom_weak::types::NumberRange as DomNumberRange; use super::super::*; @@ -51,8 +51,8 @@ impl fmt::Display for NumberRange { } } -impl From for NumberRange { - fn from(v: RbxNumberRange) -> Self { +impl From for NumberRange { + fn from(v: DomNumberRange) -> Self { Self { min: v.min, max: v.max, @@ -60,7 +60,7 @@ impl From for NumberRange { } } -impl From for RbxNumberRange { +impl From for DomNumberRange { fn from(v: NumberRange) -> Self { Self { min: v.min, diff --git a/packages/lib-roblox/src/datatypes/types/number_sequence.rs b/packages/lib-roblox/src/datatypes/types/number_sequence.rs index 60e89a7..01949ca 100644 --- a/packages/lib-roblox/src/datatypes/types/number_sequence.rs +++ b/packages/lib-roblox/src/datatypes/types/number_sequence.rs @@ -2,7 +2,7 @@ use core::fmt; use mlua::prelude::*; use rbx_dom_weak::types::{ - NumberSequence as RbxNumberSequence, NumberSequenceKeypoint as RbxNumberSequenceKeypoint, + NumberSequence as DomNumberSequence, NumberSequenceKeypoint as DomNumberSequenceKeypoint, }; use super::{super::*, NumberSequenceKeypoint}; @@ -92,8 +92,8 @@ impl fmt::Display for NumberSequence { } } -impl From for NumberSequence { - fn from(v: RbxNumberSequence) -> Self { +impl From for NumberSequence { + fn from(v: DomNumberSequence) -> Self { Self { keypoints: v .keypoints @@ -105,14 +105,14 @@ impl From for NumberSequence { } } -impl From for RbxNumberSequence { +impl From for DomNumberSequence { fn from(v: NumberSequence) -> Self { Self { keypoints: v .keypoints .iter() .cloned() - .map(RbxNumberSequenceKeypoint::from) + .map(DomNumberSequenceKeypoint::from) .collect(), } } diff --git a/packages/lib-roblox/src/datatypes/types/number_sequence_keypoint.rs b/packages/lib-roblox/src/datatypes/types/number_sequence_keypoint.rs index daee984..f57d25b 100644 --- a/packages/lib-roblox/src/datatypes/types/number_sequence_keypoint.rs +++ b/packages/lib-roblox/src/datatypes/types/number_sequence_keypoint.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::NumberSequenceKeypoint as RbxNumberSequenceKeypoint; +use rbx_dom_weak::types::NumberSequenceKeypoint as DomNumberSequenceKeypoint; use super::super::*; @@ -52,8 +52,8 @@ impl fmt::Display for NumberSequenceKeypoint { } } -impl From for NumberSequenceKeypoint { - fn from(v: RbxNumberSequenceKeypoint) -> Self { +impl From for NumberSequenceKeypoint { + fn from(v: DomNumberSequenceKeypoint) -> Self { Self { time: v.time, value: v.value, @@ -62,7 +62,7 @@ impl From for NumberSequenceKeypoint { } } -impl From for RbxNumberSequenceKeypoint { +impl From for DomNumberSequenceKeypoint { fn from(v: NumberSequenceKeypoint) -> Self { Self { time: v.time, diff --git a/packages/lib-roblox/src/datatypes/types/physical_properties.rs b/packages/lib-roblox/src/datatypes/types/physical_properties.rs index 466d01c..762c1d9 100644 --- a/packages/lib-roblox/src/datatypes/types/physical_properties.rs +++ b/packages/lib-roblox/src/datatypes/types/physical_properties.rs @@ -1,7 +1,7 @@ use core::fmt; use mlua::prelude::*; -use rbx_dom_weak::types::CustomPhysicalProperties as RbxCustomPhysicalProperties; +use rbx_dom_weak::types::CustomPhysicalProperties as DomCustomPhysicalProperties; use super::{super::*, EnumItem}; @@ -109,8 +109,8 @@ impl fmt::Display for PhysicalProperties { } } -impl From for PhysicalProperties { - fn from(v: RbxCustomPhysicalProperties) -> Self { +impl From for PhysicalProperties { + fn from(v: DomCustomPhysicalProperties) -> Self { Self { density: v.density, friction: v.friction, @@ -121,9 +121,9 @@ impl From for PhysicalProperties { } } -impl From for RbxCustomPhysicalProperties { +impl From for DomCustomPhysicalProperties { fn from(v: PhysicalProperties) -> Self { - RbxCustomPhysicalProperties { + DomCustomPhysicalProperties { density: v.density, friction: v.friction, friction_weight: v.friction_weight, diff --git a/packages/lib-roblox/src/datatypes/types/ray.rs b/packages/lib-roblox/src/datatypes/types/ray.rs index 3b1b045..ff11ad2 100644 --- a/packages/lib-roblox/src/datatypes/types/ray.rs +++ b/packages/lib-roblox/src/datatypes/types/ray.rs @@ -2,7 +2,7 @@ use core::fmt; use glam::Vec3; use mlua::prelude::*; -use rbx_dom_weak::types::Ray as RbxRay; +use rbx_dom_weak::types::Ray as DomRay; use super::{super::*, Vector3}; @@ -73,8 +73,8 @@ impl fmt::Display for Ray { } } -impl From for Ray { - fn from(v: RbxRay) -> Self { +impl From for Ray { + fn from(v: DomRay) -> Self { Ray { origin: Vector3::from(v.origin).0, direction: Vector3::from(v.direction).0, @@ -82,9 +82,9 @@ impl From for Ray { } } -impl From for RbxRay { +impl From for DomRay { fn from(v: Ray) -> Self { - RbxRay { + DomRay { origin: Vector3(v.origin).into(), direction: Vector3(v.direction).into(), } diff --git a/packages/lib-roblox/src/datatypes/types/rect.rs b/packages/lib-roblox/src/datatypes/types/rect.rs index c60e794..df5ed3c 100644 --- a/packages/lib-roblox/src/datatypes/types/rect.rs +++ b/packages/lib-roblox/src/datatypes/types/rect.rs @@ -3,7 +3,7 @@ use std::ops; use glam::Vec2; use mlua::prelude::*; -use rbx_dom_weak::types::Rect as RbxRect; +use rbx_dom_weak::types::Rect as DomRect; use super::{super::*, Vector2}; @@ -99,8 +99,8 @@ impl ops::Sub for Rect { } } -impl From for Rect { - fn from(v: RbxRect) -> Self { +impl From for Rect { + fn from(v: DomRect) -> Self { Rect { min: Vec2::new(v.min.x, v.min.y), max: Vec2::new(v.max.x, v.max.y), @@ -108,9 +108,9 @@ impl From for Rect { } } -impl From for RbxRect { +impl From for DomRect { fn from(v: Rect) -> Self { - RbxRect { + DomRect { min: Vector2(v.min).into(), max: Vector2(v.max).into(), } diff --git a/packages/lib-roblox/src/datatypes/types/region3.rs b/packages/lib-roblox/src/datatypes/types/region3.rs index 48fcab4..9f4983b 100644 --- a/packages/lib-roblox/src/datatypes/types/region3.rs +++ b/packages/lib-roblox/src/datatypes/types/region3.rs @@ -2,7 +2,7 @@ use core::fmt; use glam::{Mat4, Vec3}; use mlua::prelude::*; -use rbx_dom_weak::types::Region3 as RbxRegion3; +use rbx_dom_weak::types::Region3 as DomRegion3; use super::{super::*, CFrame, Vector3}; @@ -60,8 +60,8 @@ impl fmt::Display for Region3 { } } -impl From for Region3 { - fn from(v: RbxRegion3) -> Self { +impl From for Region3 { + fn from(v: DomRegion3) -> Self { Region3 { min: Vector3::from(v.min).0, max: Vector3::from(v.max).0, @@ -69,9 +69,9 @@ impl From for Region3 { } } -impl From for RbxRegion3 { +impl From for DomRegion3 { fn from(v: Region3) -> Self { - RbxRegion3 { + DomRegion3 { min: Vector3(v.min).into(), max: Vector3(v.max).into(), } diff --git a/packages/lib-roblox/src/datatypes/types/region3int16.rs b/packages/lib-roblox/src/datatypes/types/region3int16.rs index fba32aa..f0dd3b2 100644 --- a/packages/lib-roblox/src/datatypes/types/region3int16.rs +++ b/packages/lib-roblox/src/datatypes/types/region3int16.rs @@ -2,7 +2,7 @@ use core::fmt; use glam::IVec3; use mlua::prelude::*; -use rbx_dom_weak::types::Region3int16 as RbxRegion3int16; +use rbx_dom_weak::types::Region3int16 as DomRegion3int16; use super::{super::*, Vector3int16}; @@ -50,8 +50,8 @@ impl fmt::Display for Region3int16 { } } -impl From for Region3int16 { - fn from(v: RbxRegion3int16) -> Self { +impl From for Region3int16 { + fn from(v: DomRegion3int16) -> Self { Region3int16 { min: Vector3int16::from(v.min).0, max: Vector3int16::from(v.max).0, @@ -59,9 +59,9 @@ impl From for Region3int16 { } } -impl From for RbxRegion3int16 { +impl From for DomRegion3int16 { fn from(v: Region3int16) -> Self { - RbxRegion3int16 { + DomRegion3int16 { min: Vector3int16(v.min).into(), max: Vector3int16(v.max).into(), } diff --git a/packages/lib-roblox/src/datatypes/types/udim.rs b/packages/lib-roblox/src/datatypes/types/udim.rs index 36a768d..9fc4bc6 100644 --- a/packages/lib-roblox/src/datatypes/types/udim.rs +++ b/packages/lib-roblox/src/datatypes/types/udim.rs @@ -2,7 +2,7 @@ use core::fmt; use std::ops; use mlua::prelude::*; -use rbx_dom_weak::types::UDim as RbxUDim; +use rbx_dom_weak::types::UDim as DomUDim; use super::super::*; @@ -95,8 +95,8 @@ impl ops::Sub for UDim { } } -impl From for UDim { - fn from(v: RbxUDim) -> Self { +impl From for UDim { + fn from(v: DomUDim) -> Self { UDim { scale: v.scale, offset: v.offset, @@ -104,9 +104,9 @@ impl From for UDim { } } -impl From for RbxUDim { +impl From for DomUDim { fn from(v: UDim) -> Self { - RbxUDim { + DomUDim { scale: v.scale, offset: v.offset, } diff --git a/packages/lib-roblox/src/datatypes/types/udim2.rs b/packages/lib-roblox/src/datatypes/types/udim2.rs index bd50d95..9b34f12 100644 --- a/packages/lib-roblox/src/datatypes/types/udim2.rs +++ b/packages/lib-roblox/src/datatypes/types/udim2.rs @@ -3,7 +3,7 @@ use std::ops; use glam::Vec2; use mlua::prelude::*; -use rbx_dom_weak::types::UDim2 as RbxUDim2; +use rbx_dom_weak::types::UDim2 as DomUDim2; use super::{super::*, UDim}; @@ -140,8 +140,8 @@ impl ops::Sub for UDim2 { } } -impl From for UDim2 { - fn from(v: RbxUDim2) -> Self { +impl From for UDim2 { + fn from(v: DomUDim2) -> Self { UDim2 { x: v.x.into(), y: v.y.into(), @@ -149,9 +149,9 @@ impl From for UDim2 { } } -impl From for RbxUDim2 { +impl From for DomUDim2 { fn from(v: UDim2) -> Self { - RbxUDim2 { + DomUDim2 { x: v.x.into(), y: v.y.into(), } diff --git a/packages/lib-roblox/src/datatypes/types/vector2.rs b/packages/lib-roblox/src/datatypes/types/vector2.rs index ddf3a50..5f6b1f3 100644 --- a/packages/lib-roblox/src/datatypes/types/vector2.rs +++ b/packages/lib-roblox/src/datatypes/types/vector2.rs @@ -3,7 +3,7 @@ use std::ops; use glam::{Vec2, Vec3}; use mlua::prelude::*; -use rbx_dom_weak::types::Vector2 as RbxVector2; +use rbx_dom_weak::types::Vector2 as DomVector2; use super::super::*; @@ -128,14 +128,14 @@ impl ops::Div for Vector2 { } } -impl From for Vector2 { - fn from(v: RbxVector2) -> Self { +impl From for Vector2 { + fn from(v: DomVector2) -> Self { Vector2(Vec2 { x: v.x, y: v.y }) } } -impl From for RbxVector2 { +impl From for DomVector2 { fn from(v: Vector2) -> Self { - RbxVector2 { x: v.0.x, y: v.0.y } + DomVector2 { x: v.0.x, y: v.0.y } } } diff --git a/packages/lib-roblox/src/datatypes/types/vector2int16.rs b/packages/lib-roblox/src/datatypes/types/vector2int16.rs index 73f9536..2ae21c8 100644 --- a/packages/lib-roblox/src/datatypes/types/vector2int16.rs +++ b/packages/lib-roblox/src/datatypes/types/vector2int16.rs @@ -3,7 +3,7 @@ use std::ops; use glam::IVec2; use mlua::prelude::*; -use rbx_dom_weak::types::Vector2int16 as RbxVector2int16; +use rbx_dom_weak::types::Vector2int16 as DomVector2int16; use super::super::*; @@ -103,8 +103,8 @@ impl ops::Div for Vector2int16 { } } -impl From for Vector2int16 { - fn from(v: RbxVector2int16) -> Self { +impl From for Vector2int16 { + fn from(v: DomVector2int16) -> Self { Vector2int16(IVec2 { x: v.x.clamp(i16::MIN, i16::MAX) as i32, y: v.y.clamp(i16::MIN, i16::MAX) as i32, @@ -112,9 +112,9 @@ impl From for Vector2int16 { } } -impl From for RbxVector2int16 { +impl From for DomVector2int16 { fn from(v: Vector2int16) -> Self { - RbxVector2int16 { + DomVector2int16 { x: v.0.x.clamp(i16::MIN as i32, i16::MAX as i32) as i16, y: v.0.y.clamp(i16::MIN as i32, i16::MAX as i32) as i16, } diff --git a/packages/lib-roblox/src/datatypes/types/vector3.rs b/packages/lib-roblox/src/datatypes/types/vector3.rs index a6ab2fe..abd1c07 100644 --- a/packages/lib-roblox/src/datatypes/types/vector3.rs +++ b/packages/lib-roblox/src/datatypes/types/vector3.rs @@ -3,7 +3,7 @@ use std::ops; use glam::Vec3; use mlua::prelude::*; -use rbx_dom_weak::types::Vector3 as RbxVector3; +use rbx_dom_weak::types::Vector3 as DomVector3; use super::{super::*, EnumItem}; @@ -190,8 +190,8 @@ impl ops::Div for Vector3 { } } -impl From for Vector3 { - fn from(v: RbxVector3) -> Self { +impl From for Vector3 { + fn from(v: DomVector3) -> Self { Vector3(Vec3 { x: v.x, y: v.y, @@ -200,9 +200,9 @@ impl From for Vector3 { } } -impl From for RbxVector3 { +impl From for DomVector3 { fn from(v: Vector3) -> Self { - RbxVector3 { + DomVector3 { x: v.0.x, y: v.0.y, z: v.0.z, diff --git a/packages/lib-roblox/src/datatypes/types/vector3int16.rs b/packages/lib-roblox/src/datatypes/types/vector3int16.rs index 93111c0..e8d6f08 100644 --- a/packages/lib-roblox/src/datatypes/types/vector3int16.rs +++ b/packages/lib-roblox/src/datatypes/types/vector3int16.rs @@ -3,7 +3,7 @@ use std::ops; use glam::IVec3; use mlua::prelude::*; -use rbx_dom_weak::types::Vector3int16 as RbxVector3int16; +use rbx_dom_weak::types::Vector3int16 as DomVector3int16; use super::super::*; @@ -105,8 +105,8 @@ impl ops::Div for Vector3int16 { } } -impl From for Vector3int16 { - fn from(v: RbxVector3int16) -> Self { +impl From for Vector3int16 { + fn from(v: DomVector3int16) -> Self { Vector3int16(IVec3 { x: v.x.clamp(i16::MIN, i16::MAX) as i32, y: v.y.clamp(i16::MIN, i16::MAX) as i32, @@ -115,9 +115,9 @@ impl From for Vector3int16 { } } -impl From for RbxVector3int16 { +impl From for DomVector3int16 { fn from(v: Vector3int16) -> Self { - RbxVector3int16 { + DomVector3int16 { x: v.0.x.clamp(i16::MIN as i32, i16::MAX as i32) as i16, y: v.0.y.clamp(i16::MIN as i32, i16::MAX as i32) as i16, z: v.0.z.clamp(i16::MIN as i32, i16::MAX as i32) as i16,