pub struct Props(/* private fields */);Expand description
Implementations§
Source§impl Props
impl Props
Sourcepub fn from_json(value: Value) -> Self
pub fn from_json(value: Value) -> Self
Construct from a serde_json::Value. Non-object values (a stray
string, number, etc.) become an empty PropMap rather than a
panic, so malformed wire input degrades gracefully.
Sourcepub fn get_f64(&self, key: &str) -> Option<f64>
pub fn get_f64(&self, key: &str) -> Option<f64>
Get a numeric prop as f64 when conversion is finite and exact.
Sourcepub fn get_f32(&self, key: &str) -> Option<f32>
pub fn get_f32(&self, key: &str) -> Option<f32>
Get a numeric prop as f32 when conversion remains finite.
Sourcepub fn get_i64(&self, key: &str) -> Option<i64>
pub fn get_i64(&self, key: &str) -> Option<i64>
Get an integer prop as i64 when conversion is integral and in range.
Sourcepub fn get_u64(&self, key: &str) -> Option<u64>
pub fn get_u64(&self, key: &str) -> Option<u64>
Get an unsigned integer prop as u64 when conversion is integral and in range.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check if a key exists.
Sourcepub fn as_value_cow(&self) -> Cow<'_, Value>
pub fn as_value_cow(&self) -> Cow<'_, Value>
Convert to a JSON Value for consumption by prop_helpers.
Always allocates (converts PropMap to JSON Map). Callers that only need field-by-field access should use the typed accessors directly instead.
Sourcepub fn as_prop_map(&self) -> &PropMap
pub fn as_prop_map(&self) -> &PropMap
Borrow the underlying PropMap.
Sourcepub fn as_prop_map_mut(&mut self) -> &mut PropMap
pub fn as_prop_map_mut(&mut self) -> &mut PropMap
Mutably borrow the underlying PropMap.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Props
impl<'de> Deserialize<'de> for Props
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Props
impl StructuralPartialEq for Props
Auto Trait Implementations§
impl Freeze for Props
impl RefUnwindSafe for Props
impl Send for Props
impl Sync for Props
impl Unpin for Props
impl UnsafeUnpin for Props
impl UnwindSafe for Props
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