pub struct SocialNetwork {
pub friends: HashMap<String, Relationship>,
pub enemies: HashMap<String, Relationship>,
pub family: HashMap<String, FamilyRelation>,
pub colleagues: HashMap<String, Relationship>,
pub reputation: f64,
pub default_trust: f64,
}
Expand description
Social network connections
Fieldsยง
ยงfriends: HashMap<String, Relationship>
Friends/allies
enemies: HashMap<String, Relationship>
Enemies/competitors
family: HashMap<String, FamilyRelation>
Family/offspring
colleagues: HashMap<String, Relationship>
Professional connections
reputation: f64
Social reputation score
default_trust: f64
Trust level for new organisms
Implementationsยง
Sourceยงimpl SocialNetwork
impl SocialNetwork
pub fn new() -> Self
pub fn add_or_update_relationship( &mut self, organism_id: &str, relationship_type: RelationshipType, strength_change: f64, )
pub fn get_connection_count(&self) -> usize
Trait Implementationsยง
Sourceยงimpl Clone for SocialNetwork
impl Clone for SocialNetwork
Sourceยงfn clone(&self) -> SocialNetwork
fn clone(&self) -> SocialNetwork
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 SocialNetwork
impl Debug for SocialNetwork
Sourceยงimpl<'de> Deserialize<'de> for SocialNetwork
impl<'de> Deserialize<'de> for SocialNetwork
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 SocialNetwork
impl RefUnwindSafe for SocialNetwork
impl Send for SocialNetwork
impl Sync for SocialNetwork
impl Unpin for SocialNetwork
impl UnwindSafe for SocialNetwork
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