Struct JsonLd
pub struct JsonLd(/* private fields */);http and std only.Expand description
A valid, script-data-safe JSON-LD document.
This type guarantees JSON syntax and safe HTML embedding. It does not process JSON-LD semantics such as @context, expansion, or compaction.
Implementations§
§impl JsonLd
impl JsonLd
pub fn serialize<T>(value: &T) -> Result<JsonLd, Error>
pub fn serialize<T>(value: &T) -> Result<JsonLd, Error>
Serialize value directly into script-data-safe JSON.
Every literal less-than sign emitted by the serializer is encoded as a JSON Unicode escape so strings containing a script end tag cannot terminate an enclosing HTML script element.
pub fn from_value(value: &Value) -> JsonLd
pub fn from_value(value: &Value) -> JsonLd
Serialize an existing serde_json::Value.
Unlike arbitrary Serialize implementations, a Value cannot reject serialization, and the in-memory writer used here cannot fail.
pub fn from_bytes(bytes: Bytes) -> Result<JsonLd, Error>
pub fn from_bytes(bytes: Bytes) -> Result<JsonLd, Error>
Validate and prepare existing JSON bytes.
The original allocation is retained when the input contains no literal less-than sign. Otherwise only those bytes are rewritten into JSON Unicode escapes.
pub fn deserialize<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn deserialize<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Deserialize the document into T.
pub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume the document into its cheaply-shareable encoded bytes.
pub fn script(&self) -> JsonLdScript
Available on crate feature html only.
pub fn script(&self) -> JsonLdScript
html only.Render this document as an HTML JSON-LD data block.
Trait Implementations§
impl Eq for JsonLd
§impl IntoResponse for JsonLd
impl IntoResponse for JsonLd
§fn into_response(self) -> Response
fn into_response(self) -> Response
impl StructuralPartialEq for JsonLd
Auto Trait Implementations§
impl !Freeze for JsonLd
impl RefUnwindSafe for JsonLd
impl Send for JsonLd
impl Sync for JsonLd
impl Unpin for JsonLd
impl UnsafeUnpin for JsonLd
impl UnwindSafe for JsonLd
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<B> BodyExtractExt for B
impl<B> BodyExtractExt for B
§async fn try_into_json<T>(self) -> Result<T, Box<dyn Error + Sync + Send>>where
T: DeserializeOwned + Send + 'static,
async fn try_into_json<T>(self) -> Result<T, Box<dyn Error + Sync + Send>>where
T: DeserializeOwned + Send + 'static,
§async fn try_into_json_streaming<T>(
self,
) -> Result<T, Box<dyn Error + Sync + Send>>where
T: DeserializeOwned + Send + 'static,
async fn try_into_json_streaming<T>(
self,
) -> Result<T, Box<dyn Error + Sync + Send>>where
T: DeserializeOwned + Send + 'static,
§async fn try_into_string(self) -> Result<String, Box<dyn Error + Sync + Send>>
async fn try_into_string(self) -> Result<String, Box<dyn Error + Sync + Send>>
§async fn try_capture_json(
self,
selectors: impl IntoIterator<Item = JsonPath> + Send,
max_capture_bytes: usize,
) -> Result<Vec<OwnedCapturedValue>, Box<dyn Error + Sync + Send>>
async fn try_capture_json( self, selectors: impl IntoIterator<Item = JsonPath> + Send, max_capture_bytes: usize, ) -> Result<Vec<OwnedCapturedValue>, Box<dyn Error + Sync + Send>>
selectors while streaming over the body. Read more§async fn try_into_json_with<T>(
self,
opts: CollectOptions,
) -> Result<T, CollectError>where
T: DeserializeOwned + Send + 'static,
async fn try_into_json_with<T>(
self,
opts: CollectOptions,
) -> Result<T, CollectError>where
T: DeserializeOwned + Send + 'static,
§async fn try_into_string_with(
self,
opts: CollectOptions,
) -> Result<String, CollectError>
async fn try_into_string_with( self, opts: CollectOptions, ) -> Result<String, CollectError>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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 more§impl<O> IntoEndpointService<Response> for O
impl<O> IntoEndpointService<Response> for O
type Service = StaticOutput<O>
§fn into_endpoint_service(self) -> <O as IntoEndpointService<Response>>::Service
fn into_endpoint_service(self) -> <O as IntoEndpointService<Response>>::Service
rama_core::Service.§impl<O, State> IntoEndpointServiceWithState<Response, State> for O
impl<O, State> IntoEndpointServiceWithState<Response, State> for O
type Service = StaticOutput<O>
§fn into_endpoint_service_with_state(
self,
_state: State,
) -> <O as IntoEndpointServiceWithState<Response, State>>::Service
fn into_endpoint_service_with_state( self, _state: State, ) -> <O as IntoEndpointServiceWithState<Response, State>>::Service
rama_core::Service with state.§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)