pub enum JsonValue {
Null,
Bool(bool),
Number(f64),
String(String),
Array(Vec<JsonValue>),
Object(Vec<(String, JsonValue)>),
}Expand description
Simplified JSON value representation.
Variants§
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 Freeze for JsonValue
impl RefUnwindSafe for JsonValue
impl Send for JsonValue
impl Sync for JsonValue
impl Unpin for JsonValue
impl UnsafeUnpin for JsonValue
impl UnwindSafe for JsonValue
Blanket Implementations§
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::Request