pub enum JsonValue {
Null,
Bool(bool),
Integer(i64),
Number(f64),
Decimal(String),
String(String),
Array(Vec<JsonValue>),
Object(Vec<(String, JsonValue)>),
}Expand description
Simplified JSON value representation.
Variants§
Null
Bool(bool)
Integer(i64)
Number(f64)
Decimal(String)
String(String)
Array(Vec<JsonValue>)
Object(Vec<(String, JsonValue)>)
Implementations§
Source§impl JsonValue
impl JsonValue
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
Returns the value as mutable array.
Sourcepub fn as_object(&self) -> Option<&[(String, JsonValue)]>
pub fn as_object(&self) -> Option<&[(String, JsonValue)]>
Returns the object entries if the value is an object.
Sourcepub fn as_object_mut(&mut self) -> Option<&mut Vec<(String, JsonValue)>>
pub fn as_object_mut(&mut self) -> Option<&mut Vec<(String, JsonValue)>>
Returns a mutable reference to the object entries.
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
pub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
Retrieves mutable field value from object by key.
Sourcepub fn object(entries: Vec<(String, JsonValue)>) -> JsonValue
pub fn object(entries: Vec<(String, JsonValue)>) -> JsonValue
Convenience constructor for JSON objects.
Sourcepub fn to_json_string(&self) -> String
👎Deprecated: Use crate::serde_json::Value::to_string_compact for boundary emission; see ADR 0010 / issue #177
pub fn to_json_string(&self) -> String
Use crate::serde_json::Value::to_string_compact for boundary emission; see ADR 0010 / issue #177
Serializes the value into a compact JSON string.
Deprecation note (ADR 0010 / issue #177): the canonical
JSON encoder for serialization-boundary-sensitive paths
(audit log, HelloAck, PayloadReply, anything reaching a
downstream parser) is crate::serde_json::Value::escape_string
using to_string_compact. This local encoder is correct after
the F-01 hotfix (#181) but is not the canonical owner; new
audit / wire emission code should not call it. Existing MCP
JSON-RPC callers may keep using it pending a follow-up
retirement slice.
Trait Implementations§
impl StructuralPartialEq for JsonValue
Auto Trait Implementations§
impl Forget for JsonValue
impl Freeze for JsonValuewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<JsonValue>: Freeze,
PhantomData<(String, JsonValue)>: Freeze,
impl Move for JsonValue
impl RefUnwindSafe for JsonValue
impl Send for JsonValuewhere
RawVecInner: Send,
impl Sync for JsonValuewhere
RawVecInner: Sync,
impl Unpin for JsonValue
impl UnsafeUnpin for JsonValuewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<JsonValue>: UnsafeUnpin,
PhantomData<(String, JsonValue)>: UnsafeUnpin,
impl UnwindSafe for JsonValuewhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.