Struct JsonTransformer
pub struct JsonTransformer<T> { /* private fields */ }Available on crate feature
std only.Expand description
Drives a JsonTransform over a streamed JSON document.
Implementations§
§impl<T> JsonTransformer<T>
impl<T> JsonTransformer<T>
pub fn new(transform: T) -> JsonTransformer<T>
pub fn new(transform: T) -> JsonTransformer<T>
Creates a transformer.
pub fn with_max_buffered_bytes(
transform: T,
max_buffered_bytes: usize,
) -> JsonTransformer<T>
pub fn with_max_buffered_bytes( transform: T, max_buffered_bytes: usize, ) -> JsonTransformer<T>
Creates a transformer with a custom tokenizer token length limit.
pub const fn max_buffered_bytes(&self) -> usize
pub const fn max_buffered_bytes(&self) -> usize
Returns the tokenizer token length limit.
pub fn set_max_buffered_bytes(&mut self, max_buffered_bytes: usize)
pub fn set_max_buffered_bytes(&mut self, max_buffered_bytes: usize)
Sets the tokenizer token length limit.
pub const fn transform_mut(&mut self) -> &mut T
pub const fn transform_mut(&mut self) -> &mut T
Returns the transform mutably.
pub fn into_transform(self) -> T
pub fn into_transform(self) -> T
Consumes the transformer and returns the transform.
§impl<T> JsonTransformer<T>where
T: JsonTransform,
impl<T> JsonTransformer<T>where
T: JsonTransform,
pub fn write(
&mut self,
chunk: &[u8],
) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
pub fn write( &mut self, chunk: &[u8], ) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
Feeds a JSON chunk; forwarded tokens are copied into the output.
pub fn write_bytes(
&mut self,
chunk: &Bytes,
) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
pub fn write_bytes( &mut self, chunk: &Bytes, ) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
Feeds a JSON chunk; long forwarded runs become slices of chunk.
pub fn end(&mut self) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
pub fn end(&mut self) -> Result<(), TokenizeError<<T as JsonTransform>::Error>>
Finalizes the JSON stream.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for JsonTransformer<T>
impl<T> Forget for JsonTransformer<T>
impl<T> Move for JsonTransformer<T>
impl<T> RefUnwindSafe for JsonTransformer<T>
impl<T> Send for JsonTransformer<T>
impl<T> Sync for JsonTransformer<T>
impl<T> Unpin for JsonTransformer<T>
impl<T> UnsafeUnpin for JsonTransformer<T>where
*const u8 is !null: UnsafeUnpin,
*mut Shared: UnsafeUnpin,
PhantomData<Frame>: UnsafeUnpin,
T: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
PhantomData<Bytes>: UnsafeUnpin,
impl<T> UnwindSafe for JsonTransformer<T>where
NonNull<u8>: UnwindSafe,
*mut Shared: UnwindSafe,
RawVecInner: UnwindSafe,
T: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
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,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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> ⓘ
Converts
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> ⓘ
Converts
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
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>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more