1
1
use std:: fmt;
2
2
3
- #[ cfg( all ( any ( feature = "luau" , doc ) , feature = " serialize") ) ]
3
+ #[ cfg( feature = "serialize" ) ]
4
4
use serde:: ser:: { Serialize , SerializeTupleStruct , Serializer } ;
5
5
6
- use super :: LuaType ;
7
-
8
6
/// A Luau vector type.
9
7
///
10
8
/// By default vectors are 3-dimensional, but can be 4-dimensional
@@ -23,6 +21,7 @@ impl fmt::Display for Vector {
23
21
}
24
22
}
25
23
24
+ #[ cfg_attr( not( feature = "luau" ) , allow( unused) ) ]
26
25
impl Vector {
27
26
pub ( crate ) const SIZE : usize = if cfg ! ( feature = "luau-vector4" ) { 4 } else { 3 } ;
28
27
@@ -67,7 +66,7 @@ impl Vector {
67
66
}
68
67
}
69
68
70
- #[ cfg( all ( any ( feature = "luau" , doc ) , feature = " serialize") ) ]
69
+ #[ cfg( feature = "serialize" ) ]
71
70
impl Serialize for Vector {
72
71
fn serialize < S : Serializer > ( & self , serializer : S ) -> std:: result:: Result < S :: Ok , S :: Error > {
73
72
let mut ts = serializer. serialize_tuple_struct ( "Vector" , Self :: SIZE ) ?;
@@ -87,11 +86,7 @@ impl PartialEq<[f32; Self::SIZE]> for Vector {
87
86
}
88
87
}
89
88
90
- impl LuaType for Vector {
91
- #[ cfg( feature = "luau" ) ]
92
- const TYPE_ID : i32 = ffi:: LUA_TVECTOR ;
93
-
94
- // This is a dummy value, as `Vector` is supported only by Luau
95
- #[ cfg( not( feature = "luau" ) ) ]
96
- const TYPE_ID : i32 = ffi:: LUA_TNONE ;
89
+ #[ cfg( feature = "luau" ) ]
90
+ impl crate :: types:: LuaType for Vector {
91
+ const TYPE_ID : std:: os:: raw:: c_int = ffi:: LUA_TVECTOR ;
97
92
}
0 commit comments