aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-02-18 13:23:53 +0100
committermetamuffin <metamuffin@disroot.org>2026-02-18 13:23:53 +0100
commitb176a9f7c36bf26f0e42d8b1bc30e214de9f14c9 (patch)
tree3b95504583b23fc8985541152865e6011badbfab /common
parentb39e1a10c731fd0e61a566a0668abc33ae821b49 (diff)
downloadjellything-b176a9f7c36bf26f0e42d8b1bc30e214de9f14c9.tar
jellything-b176a9f7c36bf26f0e42d8b1bc30e214de9f14c9.tar.bz2
jellything-b176a9f7c36bf26f0e42d8b1bc30e214de9f14c9.tar.zst
object2json tag support
Diffstat (limited to 'common')
-rw-r--r--common/object/src/json.rs3
-rw-r--r--common/object/src/value.rs2
2 files changed, 3 insertions, 2 deletions
diff --git a/common/object/src/json.rs b/common/object/src/json.rs
index cbb8bda..168c0c2 100644
--- a/common/object/src/json.rs
+++ b/common/object/src/json.rs
@@ -4,7 +4,7 @@
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
-use crate::{Object, ValueType};
+use crate::{Object, Tag, ValueType};
use serde_json::{Map, Value};
pub fn object_to_json(ob: Object<'_>) -> Value {
@@ -18,6 +18,7 @@ pub fn object_to_json(ob: Object<'_>) -> Value {
let val = match (ty, sz) {
(ValueType::String, _) => ob.get_typed::<&str>(i).unwrap().to_string().into(),
(ValueType::Object, _) => object_to_json(ob.get_typed::<Object>(i).unwrap()),
+ (ValueType::Tag, 4) => ob.get_typed::<Tag>(i).unwrap().to_string().into(),
(ValueType::UInt, 4) => ob.get_typed::<u32>(i).unwrap().into(),
(ValueType::UInt, 8) => ob.get_typed::<u64>(i).unwrap().into(),
(ValueType::Int, 8) => ob.get_typed::<i64>(i).unwrap().into(),
diff --git a/common/object/src/value.rs b/common/object/src/value.rs
index eb9de7c..01b0903 100644
--- a/common/object/src/value.rs
+++ b/common/object/src/value.rs
@@ -101,7 +101,7 @@ impl Value<'_> for Tag {
}
impl ValueStore for Tag {
fn get_type(&self) -> ValueType {
- ValueType::String
+ ValueType::Tag
}
fn store_aligned(&self, buf: &mut Vec<u32>) {
buf.push(self.0.to_be());