pub struct Consents {
    pub features: HashMap<Feature, Consent>,
    pub campaigns: HashMap<String, Consent>,
}
Expand description

This struct keeps track of all granted or denied consents of a user.

There are two different types of consents:

  • Consents for common features like if we’re allowed to evaluate the locale or a user agent.
  • Consents per measurement campaign.

The time of the consent is recorded along with it’s state: If it was actually granted or denied.

Consents for common features are given indefinitely, since they are only ever recorded along with running campaigns.

Consents for campaigns only last for a certain amount of days.

Fields

features: HashMap<Feature, Consent>campaigns: HashMap<String, Consent>

Implementations

User consents to evaluate a Feature.

User denies consent to evaluate a Feature.

Returns if consent to a Feature was given.

User consents to run a specific campaign.

Arguments
  • campaign_id: The campaign ID.
  • campaign: The campaign.

User denies consent to run a specific campaign.

Returns if consent to run a campaign was given and is valid for the given period.

Returns if consent to run a campaign was given and is now valid.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.