pub enum FlagValue {
Bool(bool),
Str(String),
Number(f64),
Json(Value),
}
Expand description
FlagValue represents any of the data types supported by JSON, all of which can be used for a LaunchDarkly feature flag variation or a custom context attribute.
Variants§
Bool(bool)
Used when the value is a boolean.
Str(String)
Used when the value is a string.
Number(f64)
Used when the value is a number.
Json(Value)
Used when the value is an arbitrary JSON value.
Implementations§
source§impl FlagValue
impl FlagValue
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Attempts to convert the FlagValue into a boolean representation, returning None if the conversion is invalid.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
Attempts to convert the FlagValue into a string representation, returning None if the conversion is invalid.
sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Attempts to convert the FlagValue into a float representation, returning None if the conversion is invalid.
Trait Implementations§
source§impl<'de> Deserialize<'de> for FlagValue
impl<'de> Deserialize<'de> for FlagValue
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for FlagValue
Auto Trait Implementations§
impl Freeze for FlagValue
impl RefUnwindSafe for FlagValue
impl Send for FlagValue
impl Sync for FlagValue
impl Unpin for FlagValue
impl UnwindSafe for FlagValue
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)