pub enum SharedSerializer {
Json(JsonSerializer),
}Expand description
Shared serializer handle (Clone-friendly enum) | 共享序列化器句柄(Clone 友好枚举)
Variants§
Json(JsonSerializer)
Default JSON | 默认 JSON
Implementations§
Sourcepub fn encode<T>(&self, value: &T) -> Result<String, SerializerError>
pub fn encode<T>(&self, value: &T) -> Result<String, SerializerError>
Encode domain object | 编码领域对象
Sourcepub fn decode<T>(&self, raw: &str) -> Result<T, SerializerError>where
T: DeserializeOwned,
pub fn decode<T>(&self, raw: &str) -> Result<T, SerializerError>where
T: DeserializeOwned,
Decode storage string | 解码存储字符串
Sourcepub fn encode_bytes<T>(&self, value: &T) -> Result<Vec<u8>, SerializerError>
pub fn encode_bytes<T>(&self, value: &T) -> Result<Vec<u8>, SerializerError>
Encode to bytes | 编码为 bytes
Sourcepub fn decode_bytes<T>(&self, bytes: &[u8]) -> Result<T, SerializerError>where
T: DeserializeOwned,
pub fn decode_bytes<T>(&self, bytes: &[u8]) -> Result<T, SerializerError>where
T: DeserializeOwned,
Decode from bytes | 从 bytes 解码
Sourcepub fn as_json(&self) -> Option<&JsonSerializer>
pub fn as_json(&self) -> Option<&JsonSerializer>
Borrow as JsonSerializer if variant matches | 若为 JSON 变体则借用
Trait Implementations§
Source§fn clone(&self) -> SharedSerializer
fn clone(&self) -> SharedSerializer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn default() -> SharedSerializer
fn default() -> SharedSerializer
Returns the “default value” for a type. Read more
Source§fn from(value: JsonSerializer) -> SharedSerializer
fn from(value: JsonSerializer) -> SharedSerializer
Converts to this type from the input type.
Auto Trait Implementations§
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