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<FlagValue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<FlagValue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for FlagValue
impl Serialize for FlagValue
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more