pub struct CohortDefinition {
pub id: String,
pub properties: Value,
}Expand description
Definition of a cohort for local evaluation
Fields§
§id: String§properties: ValueProperties can be either:
- A JSON object with “type” and “values” for complex property groups
- Or a direct Vec
for simple cases
Implementations§
Source§impl CohortDefinition
impl CohortDefinition
Sourcepub fn new(id: String, properties: Vec<Property>) -> Self
pub fn new(id: String, properties: Vec<Property>) -> Self
Create a new cohort definition with simple property list
Sourcepub fn parse_properties(&self) -> Vec<Property>
pub fn parse_properties(&self) -> Vec<Property>
Parse the properties from the JSON structure PostHog cohort properties come in format: {“type”: “AND”, “values”: [{“type”: “property”, “key”: “…”, “value”: “…”, “operator”: “…”}]}
Trait Implementations§
Source§impl Clone for CohortDefinition
impl Clone for CohortDefinition
Source§fn clone(&self) -> CohortDefinition
fn clone(&self) -> CohortDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CohortDefinition
impl Debug for CohortDefinition
Source§impl<'de> Deserialize<'de> for CohortDefinition
impl<'de> Deserialize<'de> for CohortDefinition
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
Auto Trait Implementations§
impl Freeze for CohortDefinition
impl RefUnwindSafe for CohortDefinition
impl Send for CohortDefinition
impl Sync for CohortDefinition
impl Unpin for CohortDefinition
impl UnwindSafe for CohortDefinition
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