pub struct M3Codec;Expand description
M3 Codec for schema-aware compression
Implementations§
Source§impl M3Codec
impl M3Codec
Sourcepub fn encode_request(&self, req: &M3ChatRequest) -> Result<Vec<u8>>
pub fn encode_request(&self, req: &M3ChatRequest) -> Result<Vec<u8>>
Encode a chat completion request to M3 wire format
Sourcepub fn decode_request(&self, data: &[u8]) -> Result<M3ChatRequest>
pub fn decode_request(&self, data: &[u8]) -> Result<M3ChatRequest>
Decode M3 wire format to chat completion request
Sourcepub fn from_json(&self, json: &str) -> Result<M3ChatRequest>
pub fn from_json(&self, json: &str) -> Result<M3ChatRequest>
Parse JSON to M3ChatRequest
Sourcepub fn to_json(&self, req: &M3ChatRequest) -> String
pub fn to_json(&self, req: &M3ChatRequest) -> String
Convert M3ChatRequest back to JSON
Sourcepub fn compress(&self, json: &str) -> Result<(String, usize, usize)>
👎Deprecated: Use M2M codec instead
pub fn compress(&self, json: &str) -> Result<(String, usize, usize)>
Compress JSON to M3 wire format
DEPRECATED: Use M2M codec instead.
Sourcepub fn decompress(&self, wire: &str) -> Result<String>
pub fn decompress(&self, wire: &str) -> Result<String>
Decompress M3 wire format to JSON
Sourcepub fn is_m3_format(content: &str) -> bool
pub fn is_m3_format(content: &str) -> bool
Check if content is M3 format
Trait Implementations§
Auto Trait Implementations§
impl Freeze for M3Codec
impl RefUnwindSafe for M3Codec
impl Send for M3Codec
impl Sync for M3Codec
impl Unpin for M3Codec
impl UnwindSafe for M3Codec
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
Mutably borrows from an owned value. Read more
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>
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