pub struct JsonCodecHelper;
Implementations§
Source§impl JsonCodecHelper
impl JsonCodecHelper
pub fn is_none_node(node: &Value) -> bool
pub fn encode_string(obj: Map<String, Value>) -> String
pub fn encode_value(obj: Map<String, Value>) -> Value
pub fn encode_string_field<T>( obj: &mut Map<String, Value>, key: impl ToString, value: &T, )
pub fn encode_string_field_2( obj: &mut Map<String, Value>, key: impl ToString, value: impl ToString, )
pub fn encode_option_string_field<T>( obj: &mut Map<String, Value>, key: impl ToString, value: Option<&T>, )
pub fn encode_number_field<T>( obj: &mut Map<String, Value>, key: impl ToString, value: T, )
pub fn encode_bool_field( obj: &mut Map<String, Value>, key: impl ToString, value: bool, )
pub fn encode_option_number_field<T>( obj: &mut Map<String, Value>, key: impl ToString, value: Option<T>, )
pub fn decode_string_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<T>
pub fn decode_option_string_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Option<T>>
pub fn decode_serde_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<T>where
T: for<'a> Deserialize<'a>,
pub fn decode_option_serde_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<Option<T>>where
T: for<'a> Deserialize<'a>,
pub fn decode_int_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<T>
pub fn decode_option_int_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Option<T>>
pub fn decode_to_int<T>(v: &Value) -> BuckyResult<T>
pub fn decode_from_serde_string<T>(v: &Value) -> BuckyResult<T>where
T: for<'a> Deserialize<'a>,
pub fn decode_from_string<T>(v: &Value) -> BuckyResult<T>
pub fn decode_bool_field( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<bool>
pub fn decode_object_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<T>where
T: for<'de> RawFrom<'de, T>,
pub fn decode_object_from_string<T>(v: &Value) -> BuckyResult<T>where
T: for<'de> RawFrom<'de, T>,
pub fn decode_from_boolean(v: &Value) -> BuckyResult<bool>
Sourcepub fn encode_number_array_field<T>(
obj: &mut Map<String, Value>,
key: &str,
value: &Vec<T>,
)
pub fn encode_number_array_field<T>( obj: &mut Map<String, Value>, key: &str, value: &Vec<T>, )
number array
pub fn encode_to_number_array<T>(list: &Vec<T>) -> Value
pub fn decode_int_array_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Vec<T>>
pub fn decode_option_int_array_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Option<Vec<T>>>
pub fn decode_from_int_array<T>(v: &Value) -> BuckyResult<Vec<T>>
Sourcepub fn encode_str_array_field<T>(
obj: &mut Map<String, Value>,
key: &str,
value: &Vec<T>,
)where
T: ToString,
pub fn encode_str_array_field<T>(
obj: &mut Map<String, Value>,
key: &str,
value: &Vec<T>,
)where
T: ToString,
string array
pub fn encode_option_str_array_field<T>(
obj: &mut Map<String, Value>,
key: &str,
value: Option<&Vec<T>>,
)where
T: ToString,
pub fn encode_to_str_array<T>(list: &Vec<T>) -> Valuewhere
T: ToString,
pub fn decode_str_array_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Vec<T>>
pub fn decode_option_str_array_field<T>( obj: &Map<String, Value>, key: &str, ) -> BuckyResult<Option<Vec<T>>>
pub fn decode_from_str_array<T>(v: &Value) -> BuckyResult<Vec<T>>
pub fn encode_as_list<T>(
obj: &mut Map<String, Value>,
key: &str,
value: &Vec<T>,
)where
T: JsonCodec<T>,
pub fn encode_as_option_list<T>(
obj: &mut Map<String, Value>,
key: &str,
value: Option<&Vec<T>>,
)where
T: JsonCodec<T>,
pub fn encode_to_array<T>(list: &Vec<T>) -> Valuewhere
T: JsonCodec<T>,
pub fn decode_array_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<Vec<T>>where
T: JsonCodec<T>,
pub fn decode_option_array_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<Option<Vec<T>>>where
T: JsonCodec<T>,
pub fn decode_from_array<T>(v: &Value) -> BuckyResult<Vec<T>>where
T: JsonCodec<T>,
pub fn encode_field<T>(
obj: &mut Map<String, Value>,
key: impl ToString,
value: &T,
)where
T: JsonCodec<T>,
pub fn encode_option_field<T>(
obj: &mut Map<String, Value>,
key: impl ToString,
value: Option<&T>,
)where
T: JsonCodec<T>,
pub fn decode_field<T>(obj: &Map<String, Value>, key: &str) -> BuckyResult<T>where
T: JsonCodec<T>,
pub fn decode_option_field<T>(
obj: &Map<String, Value>,
key: &str,
) -> BuckyResult<Option<T>>where
T: JsonCodec<T>,
pub fn decode_from_object<T>(v: &Value) -> BuckyResult<T>where
T: JsonCodec<T>,
Auto Trait Implementations§
impl Freeze for JsonCodecHelper
impl RefUnwindSafe for JsonCodecHelper
impl Send for JsonCodecHelper
impl Sync for JsonCodecHelper
impl Unpin for JsonCodecHelper
impl UnwindSafe for JsonCodecHelper
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> 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