pub enum UserValue {
Null,
Bool(bool),
Int {
value: i128,
string_value: String,
},
Float {
value: f64,
int_value: Option<i64>,
string_value: String,
hash_string: String,
},
String(UserString),
Array {
values: Vec<UserValue>,
string_value: UserString,
},
Object {
values: UserValueMap,
serialized_value: Box<RawValue>,
},
}Expand description
Eager, evaluation-ready representation for constructor-hot user fields.
This keeps Python-created StatsigUser data off the heavier DynamicValue
path while preserving the same primitive coercions the evaluator relies on.
Variants§
Implementations§
Source§impl UserValue
impl UserValue
pub fn new() -> Self
pub fn from_string(value: impl Into<String>) -> Self
pub fn from_bool(value: bool) -> Self
pub fn from_i64(value: i64) -> Self
pub fn from_u64(value: u64) -> Self
pub fn from_f64(value: f64) -> Self
pub fn from_array(values: Vec<UserValue>) -> Self
pub fn from_object(values: UserValueMap) -> Self
pub fn from_json_value(value: JsonValue) -> Self
pub fn hash_value(&self) -> u64
pub fn string_value(&self) -> Option<&str>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UserValue
impl<'de> Deserialize<'de> for UserValue
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
Source§impl<'a> From<&'a UserValue> for UserValueRef<'a>
impl<'a> From<&'a UserValue> for UserValueRef<'a>
Source§impl From<DynamicValue> for UserValue
impl From<DynamicValue> for UserValue
Source§fn from(value: DynamicValue) -> Self
fn from(value: DynamicValue) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for UserValue
impl RefUnwindSafe for UserValue
impl Send for UserValue
impl Sync for UserValue
impl Unpin for UserValue
impl UnsafeUnpin for UserValue
impl UnwindSafe for UserValue
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoOptional<T> for T
impl<T> IntoOptional<T> for T
fn into_optional(self) -> Option<T>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.