Repository: zhiburt/tabled
Pull request #518 (2025-03-23 21:47:53)

Update ron to 0.9
close #514


Patch:
diff --git a/ron_to_table/Cargo.toml b/ron_to_table/Cargo.toml
index c30a977..36f74f1 100644
--- a/ron_to_table/Cargo.toml
+++ b/ron_to_table/Cargo.toml
@@ -18,7 +18,7 @@ derive = ["tabled/derive"]
 macros = ["tabled/macros"]
 
 [dependencies]
-ron = "0.8"
+ron = "0.9"
 tabled = { path = "../tabled", features = ["std"], default-features = false }
 
 [dev-dependencies]
diff --git a/ron_to_table/src/table.rs b/ron_to_table/src/table.rs
index a6669be..752d452 100644
--- a/ron_to_table/src/table.rs
+++ b/ron_to_table/src/table.rs
@@ -147,10 +147,25 @@ fn convert_value_to_table_value(value: &Value, ctx: CollapseCtx) -> TableValue {
         Value::Seq(list) => convert_list(list, ctx),
         Value::Bool(value) => TableValue::Cell(value.to_string()),
         Value::Char(char) => TableValue::Cell(char.to_string()),
-        Value::Number(Number::Integer(number)) => TableValue::Cell(number.to_string()),
-        Value::Number(Number::Float(number)) => TableValue::Cell(number.get().to_string()),
         Value::String(text) => TableValue::Cell(text.to_owned()),
         Value::Unit => TableValue::Cell(String::new()),
+        Value::Bytes(bytes) => TableValue::Cell(format!("{:?}", bytes)),
+        Value::Number(num) => {
+            let value = match num {
+                Number::I8(num) => num.to_string(),
+                Number::I16(num) => num.to_string(),
+                Number::I32(num) => num.to_string(),
+                Number::I64(num) => num.to_string(),
+                Number::U8(num) => num.to_string(),
+                Number::U16(num) => num.to_string(),
+                Number::U32(num) => num.to_string(),
+                Number::U64(num) => num.to_string(),
+                Number::F32(num) => num.get().to_string(),
+                Number::F64(num) => num.get().to_string(),
+            };
+
+            TableValue::Cell(value)
+        }
     }
 }
 
@@ -386,8 +401,23 @@ fn _plain_table(value: &Value, cfg: &RonTable, outer: bool) -> String {
         Value::String(text) => string_table(text.to_owned(), config, outer),
         Value::Bool(val) => string_table(val.to_string(), config, outer),
         Value::Char(char) => string_table(char.to_string(), config, outer),
-        Value::Number(Number::Integer(num)) => string_table(num.to_string(), config, outer),
-        Value::Number(Number::Float(num)) => string_table(num.get().to_string(), config, outer),
+        Value::Bytes(bytes) => string_table(format!("{:?}", bytes), config, outer),
+        Value::Number(num) => {
+            let value = match num {
+                Number::I8(num) => num.to_string(),
+                Number::I16(num) => num.to_string(),
+                Number::I32(num) => num.to_string(),
+                Number::I64(num) => num.to_string(),
+                Number::U8(num) => num.to_string(),
+                Number::U16(num) => num.to_string(),
+                Number::U32(num) => num.to_string(),
+                Number::U64(num) => num.to_string(),
+                Number::F32(num) => num.get().to_string(),
+                Number::F64(num) => num.get().to_string(),
+            };
+
+            string_table(value, config, outer)
+        }
     }
 }
 


Test patch:
diff --git a/ron_to_table/tests/collapse_tests.rs b/ron_to_table/tests/collapse_tests.rs
index 4974698..e649f3f 100644
--- a/ron_to_table/tests/collapse_tests.rs
+++ b/ron_to_table/tests/collapse_tests.rs
@@ -1,6 +1,6 @@
 use std::iter::FromIterator;
 
-use ron::{value::Float, Map, Number, Value};
+use ron::{value::F32, Map, Number, Value};
 use tabled::assert::test_table;
 use tabled::settings::Alignment;
 
@@ -48,7 +48,7 @@ test_table!(
 
 test_table!(
     test_int,
-    build_ron_table(Value::Number(Number::Integer(123456789))),
+    build_ron_table(Value::Number(Number::U64(123456789))),
     "+-----------+"
     "| 123456789 |"
     "+-----------+"
@@ -56,10 +56,18 @@ test_table!(
 
 test_table!(
     test_float,
-    build_ron_table(Value::Number(Number::Float(Float::new(123.456789)))),
-    "+------------+"
-    "| 123.456789 |"
-    "+------------+"
+    build_ron_table(Value::Number(Number::F32(F32::new(123.45679)))),
+    "+-----------+"
+    "| 123.45679 |"
+    "+-----------+"
+);
+
+test_table!(
+    test_bytes,
+    build_ron_table(Value::Bytes(vec![1, 2, 3, 4, 5])),
+    "+-----------------+"
+    "| [1, 2, 3, 4, 5] |"
+    "+-----------------+"
 );
 
 test_table!(
diff --git a/ron_to_table/tests/plain_tests.rs b/ron_to_table/tests/plain_tests.rs
index 6acc991..83ecb47 100644
--- a/ron_to_table/tests/plain_tests.rs
+++ b/ron_to_table/tests/plain_tests.rs
@@ -1,6 +1,6 @@
 use std::iter::FromIterator;
 
-use ron::{value::Float, Map, Number, Value};
+use ron::{value::F32, Map, Number, Value};
 use tabled::assert::test_table;
 use tabled::settings::Alignment;
 
@@ -11,37 +11,57 @@ test_table!(test_unit, build_ron_table(Value::Unit).to_string(), "");
 test_table!(
     test_string,
     build_ron_table(Value::String(String::from("123456789"))),
-    "+-----------+\n| 123456789 |\n+-----------+"
+    "+-----------+"
+    "| 123456789 |"
+    "+-----------+"
 );
 
 test_table!(
     test_bool_true,
     build_ron_table(Value::Bool(true)),
-    "+------+\n| true |\n+------+"
+    "+------+"
+    "| true |"
+    "+------+"
 );
 
 test_table!(
     test_bool_false,
     build_ron_table(Value::Bool(false)),
-    "+-------+\n| false |\n+-------+"
+    "+-------+"
+    "| false |"
+    "+-------+"
 );
 
 test_table!(
     test_char,
     build_ron_table(Value::Char('a')),
-    "+---+\n| a |\n+---+"
+    "+---+"
+    "| a |"
+    "+---+"
 );
 
 test_table!(
     test_int,
-    build_ron_table(Value::Number(Number::Integer(123456789))),
-    "+-----------+\n| 123456789 |\n+-----------+"
+    build_ron_table(Value::Number(Number::U32(123456789))),
+    "+-----------+"
+    "| 123456789 |"
+    "+-----------+"
 );
 
 test_table!(
     test_float,
-    build_ron_table(Value::Number(Number::Float(Float::new(123.456789)))),
-    "+------------+\n| 123.456789 |\n+------------+"
+    build_ron_table(Value::Number(Number::F32(F32(123.45679)))),
+    "+-----------+"
+    "| 123.45679 |"
+    "+-----------+"
+);
+
+test_table!(
+    test_bytes,
+    build_ron_table(Value::Bytes(vec![1, 2, 3, 4, 5])),
+    "+-----------------+"
+    "| [1, 2, 3, 4, 5] |"
+    "+-----------------+"
 );
 
 test_table!(