pub enum SharedSerializer {
Json(JsonSerializer),
Fory(ForySerializer),
}Expand description
Shared serializer handle (Clone-friendly enum) | 共享序列化器句柄(Clone 友好枚举)
Variants§
Json(JsonSerializer)
Default JSON | 默认 JSON
Fory(ForySerializer)
fory binary (feature fory) | fory 二进制
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 变体则借用
Sourcepub fn as_fory(&self) -> Option<&ForySerializer>
pub fn as_fory(&self) -> Option<&ForySerializer>
Borrow as ForySerializer if variant matches | 若为 fory 变体则借用
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: ForySerializer) -> SharedSerializer
fn from(value: ForySerializer) -> SharedSerializer
Converts to this type from the input type.
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