summaryrefslogtreecommitdiffstats
path: root/tests/rust/const_generics_constant.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rust/const_generics_constant.rs')
-rw-r--r--tests/rust/const_generics_constant.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/rust/const_generics_constant.rs b/tests/rust/const_generics_constant.rs
new file mode 100644
index 0000000..83ed860
--- /dev/null
+++ b/tests/rust/const_generics_constant.rs
@@ -0,0 +1,18 @@
+#[repr(C)]
+pub struct FixedPoint<const FRACTION_BITS: u16> {
+ value: u16,
+}
+
+pub const FONT_WEIGHT_FRACTION_BITS: u16 = 6;
+
+pub type FontWeightFixedPoint = FixedPoint<FONT_WEIGHT_FRACTION_BITS>;
+
+#[repr(C)]
+pub struct FontWeight(FontWeightFixedPoint);
+
+impl FontWeight {
+ pub const NORMAL: FontWeight = FontWeight(FontWeightFixedPoint { value: 400 << FONT_WEIGHT_FRACTION_BITS });
+}
+
+#[no_mangle]
+pub extern "C" fn root(w: FontWeight) {}