PersonaProfile

Struct PersonaProfile 

Source
pub struct PersonaProfile {
    pub id: String,
    pub domain: Domain,
    pub traits: HashMap<String, String>,
    pub seed: u64,
    pub backstory: Option<String>,
    pub relationships: HashMap<String, Vec<String>>,
    pub metadata: HashMap<String, Value>,
    pub lifecycle: Option<PersonaLifecycle>,
}
Expand description

Persona profile defining a consistent data personality

Fields§

§id: String

Unique identifier for this persona (e.g., user_id, device_id, transaction_id)

§domain: Domain

Business domain this persona belongs to

§traits: HashMap<String, String>

Trait name to value mappings (e.g., “spending_level” → “high”, “account_type” → “premium”)

§seed: u64

Deterministic seed derived from persona ID and domain for consistency

§backstory: Option<String>

Narrative backstory explaining persona behavior and characteristics

§relationships: HashMap<String, Vec<String>>

Relationships to other personas Keys: relationship types (“owns_devices”, “belongs_to_org”, “has_users”) Values: List of related persona IDs

§metadata: HashMap<String, Value>

Additional persona-specific metadata

§lifecycle: Option<PersonaLifecycle>

Optional lifecycle state management

Implementations§

Source§

impl PersonaProfile

Source

pub fn new(id: String, domain: Domain) -> PersonaProfile

Create a new persona profile

The seed is deterministically derived from the persona ID and domain, ensuring the same ID and domain always produce the same seed.

Source

pub fn with_traits( id: String, domain: Domain, traits: HashMap<String, String>, ) -> PersonaProfile

Create a persona with initial traits

Source

pub fn set_lifecycle(&mut self, lifecycle: PersonaLifecycle)

Set the persona’s lifecycle

Source

pub fn get_lifecycle(&self) -> Option<&PersonaLifecycle>

Get the persona’s lifecycle

Source

pub fn get_lifecycle_mut(&mut self) -> Option<&mut PersonaLifecycle>

Get mutable reference to lifecycle

Source

pub fn update_lifecycle_state(&mut self, current_time: DateTime<Utc>)

Update lifecycle state based on virtual clock time

Checks if any transitions should occur based on elapsed time and conditions.

Source

pub fn set_trait(&mut self, name: String, value: String)

Add or update a trait

Source

pub fn get_trait(&self, name: &str) -> Option<&String>

Get a trait value

Source

pub fn set_metadata(&mut self, key: String, value: Value)

Add metadata

Source

pub fn get_metadata(&self, key: &str) -> Option<&Value>

Get metadata

Source

pub fn set_backstory(&mut self, backstory: String)

Set the persona’s backstory

The backstory provides narrative context that explains the persona’s behavior and characteristics, enabling coherent data generation.

Source

pub fn get_backstory(&self) -> Option<&String>

Get the persona’s backstory

Source

pub fn has_backstory(&self) -> bool

Check if the persona has a backstory

Source

pub fn add_relationship( &mut self, relationship_type: String, related_persona_id: String, )

Add a relationship to another persona

§Arguments
  • relationship_type - Type of relationship (e.g., “owns_devices”, “belongs_to_org”, “has_users”)
  • related_persona_id - ID of the related persona
Source

pub fn get_relationships(&self, relationship_type: &str) -> Option<&Vec<String>>

Get all relationships of a specific type

Returns a list of persona IDs that have the specified relationship type.

Get all related personas for a specific relationship type

Returns a cloned vector of persona IDs, or an empty vector if no relationships exist.

Source

pub fn get_relationship_types(&self) -> Vec<String>

Get all relationship types for this persona

Source

pub fn remove_relationship( &mut self, relationship_type: &str, related_persona_id: &str, ) -> bool

Remove a specific relationship

Removes the specified persona ID from the relationship type’s list. Returns true if the relationship was found and removed.

Trait Implementations§

Source§

impl Clone for PersonaProfile

Source§

fn clone(&self) -> PersonaProfile

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PersonaProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PersonaProfile

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PersonaProfile, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PersonaProfile

Source§

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ParallelSend for T