pub struct SerializedJsonField;Expand description
Typed guard for JSON-envelope field construction. See module docs.
Zero-sized; the type exists only to namespace the constructors and
to make audit grep (SerializedJsonField::tainted,
SerializedJsonField::typed) trivially locatable.
Implementations§
Source§impl SerializedJsonField
impl SerializedJsonField
Sourcepub fn tainted(s: &str) -> Value
pub fn tainted(s: &str) -> Value
Wrap an untrusted, caller-influenced string as a JSON value.
The returned Value::String will, on serialization through
Value::to_string_compact, have every control byte
(U+0000..U+001F), embedded ", \, and other JSON
delimiters escaped per RFC 8259 §7. The downstream parser sees
the original bytes verbatim — it does not see the bytes as
envelope structure.
This function is the canonical entry point for caller- influenced JSON-envelope fields. Examples:
- Error messages reaching
json_error(HTTP body) - SQL parser error fragments (F-05 fix)
- User-supplied identifiers reflected back into a response
- Connection-string fragments arriving via
reddb_wire::Taintedafterescape_for(Boundary::JsonValue)
Sourcepub fn typed<T>(value: &T) -> Valuewhere
T: JsonEncode + ?Sized,
pub fn typed<T>(value: &T) -> Valuewhere
T: JsonEncode + ?Sized,
Wrap a server-owned, typed value as a JSON value.
Use this for structs and enums whose schema the server owns
(configuration, status snapshots, typed view-models). The
JsonEncode impl walks the type and produces the canonical
Value tree; any nested string fields automatically inherit
the round-trip guarantee.
Note: JsonEncode is this workspace’s in-house counterpart to
serde::Serialize; the dependency-free split is documented in
crate::serde_json.
Auto Trait Implementations§
impl Freeze for SerializedJsonField
impl RefUnwindSafe for SerializedJsonField
impl Send for SerializedJsonField
impl Sync for SerializedJsonField
impl Unpin for SerializedJsonField
impl UnsafeUnpin for SerializedJsonField
impl UnwindSafe for SerializedJsonField
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> 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