pub struct Individual {Show 19 fields
pub id: Option<String>,
pub href: Option<String>,
pub aristocratic_title: Option<String>,
pub birth_date: Option<DateTime>,
pub full_name: Option<String>,
pub gender: Option<String>,
pub generation: Option<String>,
pub given_name: Option<String>,
pub legal_name: Option<String>,
pub location: Option<String>,
pub marital_status: Option<String>,
pub middle_name: Option<String>,
pub nationality: Option<String>,
pub place_of_birth: Option<String>,
pub preferred_given_name: Option<String>,
pub title: Option<String>,
pub contact_medium: Option<Vec<ContactMedium>>,
pub related_party: Option<Vec<RelatedParty>>,
pub party_characteristic: Option<Vec<Characteristic>>,
/* private fields */
}
Expand description
An individual
Fields§
§id: Option<String>
Unique id for this individual
href: Option<String>
HTML reference for this individual object
aristocratic_title: Option<String>
Aristocratic Title, e.g. Lord, Lady, Count
birth_date: Option<DateTime>
Date of Birth
full_name: Option<String>
Full name of the individual
gender: Option<String>
Gender
generation: Option<String>
Generation
given_name: Option<String>
Given Name
legal_name: Option<String>
Legal Name
location: Option<String>
Location
marital_status: Option<String>
Marital Status
middle_name: Option<String>
Middle Name
nationality: Option<String>
Nationality
place_of_birth: Option<String>
Birth Place
preferred_given_name: Option<String>
Preferred Given Name
title: Option<String>
Title, e.g.Mr, Mrs etc
contact_medium: Option<Vec<ContactMedium>>
Methods for contacting this individual
Parties related to this individual, e.g. company / organization
party_characteristic: Option<Vec<Characteristic>>
Party Characteristics
Implementations§
Source§impl Individual
impl Individual
Sourcepub fn new(name: impl Into<String>) -> Individual
pub fn new(name: impl Into<String>) -> Individual
Create a new instance of indiviudal object
Examples found in repository?
More examples
10fn main() {
11 // Create a value of type i32
12 let cat = Category::new("Example Category");
13 let catalog = Catalog::new("Example Catalog");
14 let individual = Individual::new("Example Individual");
15
16 let cat_ref = cat.as_ref();
17 let catalog_ref = catalog.as_ref();
18 let individual_ref = individual.as_ref();
19
20 dbg!(cat_ref);
21 dbg!(catalog_ref);
22 dbg!(individual_ref);
23}
12fn main() {
13 #[cfg(all(feature = "tmf681", feature = "build-V4"))]
14 {
15 let from = Individual::new("John Smith");
16 let to1 = Individual::new("Suzy Citizen");
17 let to2 = Individual::new("Ryan Ruckley").email("rruckley@gmail.com");
18
19 let message = CommunicationMessage::email("A Subject", "Some Content")
20 .from(&from)
21 .to(vec![&to1, &to2]);
22
23 dbg!(message);
24 }
25}
Sourcepub fn email(self, email: &str) -> Individual
pub fn email(self, email: &str) -> Individual
Convenience function to add an email contact medium
§Example
use tmflib::tmf632::individual_v4::Individual;
let individual = Individual::new("John Smith")
.email("john.smith@example.com");
Examples found in repository?
More examples
12fn main() {
13 #[cfg(all(feature = "tmf681", feature = "build-V4"))]
14 {
15 let from = Individual::new("John Smith");
16 let to1 = Individual::new("Suzy Citizen");
17 let to2 = Individual::new("Ryan Ruckley").email("rruckley@gmail.com");
18
19 let message = CommunicationMessage::email("A Subject", "Some Content")
20 .from(&from)
21 .to(vec![&to1, &to2]);
22
23 dbg!(message);
24 }
25}
21fn main() {
22 #[cfg(all(feature = "tmf663", feature = "build-V4"))]
23 {
24 let mut cart = ShoppingCart::new();
25 let offer = ProductOffering::new("MyProductOffer");
26 let por = ProductOfferingRef::from(offer);
27 let individual = Individual::new("John Smith")
28 .email("john.smith@example.com")
29 .mobile("0411 111 111");
30 let note1 = Note::from("Checking on stock levels");
31
32 let mut item = CartItem::from(por);
33 item.add_note(note1);
34 cart.add_item(item);
35 cart.add_party(RelatedParty::from(&individual));
36
37 dbg!(cart);
38 }
39}
26fn main() {
27 #[cfg(all(feature = "tmf663", feature = "build-V4"))]
28 {
29 let mut cart = ShoppingCart::new();
30 let offer = ProductOffering::new("MyProductOffer");
31 let individual = Individual::new("John Smith")
32 .email("john.smith@example.com")
33 .mobile("0411 111 111");
34 let note1 = Note::from("Checking on stock levels");
35
36 let mut item = CartItem::from(ProductOfferingRef::from(offer));
37 item.add_note(note1);
38 item.quantity = 11;
39 cart.add_item(item);
40 cart.add_party(RelatedParty::from(&individual));
41
42 let order = ProductOrder::from(cart);
43
44 dbg!(order);
45 }
46}
Sourcepub fn title(self, title: impl Into<String>) -> Individual
pub fn title(self, title: impl Into<String>) -> Individual
Convenience function to set the title for an individual
§Example
use tmflib::tmf632::individual_v4::Individual;
let individual = Individual::new("John Smith")
.title("Mr");
Sourcepub fn gender(self, gender: impl Into<String>) -> Individual
pub fn gender(self, gender: impl Into<String>) -> Individual
Convenience function to set the gender for an individual
§Example
use tmflib::tmf632::individual_v4::Individual;
let individual = Individual::new("John Smith")
.gender("Unspecified");
Sourcepub fn preferred(self, preferred: impl Into<String>) -> Individual
pub fn preferred(self, preferred: impl Into<String>) -> Individual
Convenience function to set the preferred given name for an individual
§Example
use tmflib::tmf632::individual_v4::Individual;
let individual = Individual::new("John Smith")
.gender("Unspecified");
Sourcepub fn mobile(self, mobile: &str) -> Individual
pub fn mobile(self, mobile: &str) -> Individual
Convenience funciton to add a mobile number contact medium
§Example
use tmflib::tmf632::individual_v4::Individual;
let individual = Individual::new("John Smith")
.mobile("0411 111 111");
Examples found in repository?
More examples
21fn main() {
22 #[cfg(all(feature = "tmf663", feature = "build-V4"))]
23 {
24 let mut cart = ShoppingCart::new();
25 let offer = ProductOffering::new("MyProductOffer");
26 let por = ProductOfferingRef::from(offer);
27 let individual = Individual::new("John Smith")
28 .email("john.smith@example.com")
29 .mobile("0411 111 111");
30 let note1 = Note::from("Checking on stock levels");
31
32 let mut item = CartItem::from(por);
33 item.add_note(note1);
34 cart.add_item(item);
35 cart.add_party(RelatedParty::from(&individual));
36
37 dbg!(cart);
38 }
39}
26fn main() {
27 #[cfg(all(feature = "tmf663", feature = "build-V4"))]
28 {
29 let mut cart = ShoppingCart::new();
30 let offer = ProductOffering::new("MyProductOffer");
31 let individual = Individual::new("John Smith")
32 .email("john.smith@example.com")
33 .mobile("0411 111 111");
34 let note1 = Note::from("Checking on stock levels");
35
36 let mut item = CartItem::from(ProductOfferingRef::from(offer));
37 item.add_note(note1);
38 item.quantity = 11;
39 cart.add_item(item);
40 cart.add_party(RelatedParty::from(&individual));
41
42 let order = ProductOrder::from(cart);
43
44 dbg!(order);
45 }
46}
Sourcepub fn add_contact(&mut self, medium: ContactMedium)
pub fn add_contact(&mut self, medium: ContactMedium)
Add a contact medium to the individual
Examples found in repository?
28fn main() {
29 #[cfg(all(feature = "tmf622", feature = "build-V4"))]
30 {
31 // This example simple creates in memory structures without reference to any persistence
32 let offer = ProductOffering::new("Sample Offering");
33 let org = Organization::new("ACustomer");
34 let customer = Customer::new(org);
35 let mut person = Individual::new("John Smith");
36 person.add_contact(ContactMedium::email("John.Smith@example.com"));
37 let mut order = ProductOrder::new();
38 order.add_order_item(ProductOrderItem::from(offer));
39 order.add_party(RelatedParty::from(&customer));
40 order.add_party(RelatedParty::from(&person));
41 dbg!(order);
42 }
43}
Sourcepub fn get_mobile(&self) -> Option<String>
pub fn get_mobile(&self) -> Option<String>
Get Mobile number from contact medium if present
Sourcepub fn replace_characteristic(
&mut self,
characteristic: Characteristic,
) -> Option<Characteristic>
pub fn replace_characteristic( &mut self, characteristic: Characteristic, ) -> Option<Characteristic>
Replace a characteristic returning the old value if found
Sourcepub fn generate_code(&mut self, offset: Option<u32>)
pub fn generate_code(&mut self, offset: Option<u32>)
Generate a new site code based on available fields
Trait Implementations§
Source§impl Clone for Individual
impl Clone for Individual
Source§fn clone(&self) -> Individual
fn clone(&self) -> Individual
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Individual
impl Debug for Individual
Source§impl Default for Individual
impl Default for Individual
Source§fn default() -> Individual
fn default() -> Individual
Source§impl<'de> Deserialize<'de> for Individual
impl<'de> Deserialize<'de> for Individual
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>,
Source§impl EventPayload<IndividualEvent> for Individual
impl EventPayload<IndividualEvent> for Individual
Source§type Subject = Individual
type Subject = Individual
Source§type EventType = IndividualEventType
type EventType = IndividualEventType
Source§impl From<&Individual> for Contact
impl From<&Individual> for Contact
Source§fn from(value: &Individual) -> Self
fn from(value: &Individual) -> Self
Source§impl From<&Individual> for Receiver
impl From<&Individual> for Receiver
Source§fn from(value: &Individual) -> Self
fn from(value: &Individual) -> Self
Source§impl From<&Individual> for RelatedParty
impl From<&Individual> for RelatedParty
Source§fn from(value: &Individual) -> Self
fn from(value: &Individual) -> Self
Source§impl From<&Individual> for Sender
impl From<&Individual> for Sender
Source§fn from(value: &Individual) -> Self
fn from(value: &Individual) -> Self
Source§impl HasId for Individual
impl HasId for Individual
Source§fn generate_id(&mut self)
fn generate_id(&mut self)
Source§fn generate_href(&mut self)
fn generate_href(&mut self)
Source§fn get_class() -> String
fn get_class() -> String
Source§fn get_class_href() -> String
fn get_class_href() -> String
Source§fn get_mod_path() -> String
fn get_mod_path() -> String
Source§fn set_id(&mut self, id: impl Into<String>)
fn set_id(&mut self, id: impl Into<String>)
Source§fn id(self, id: impl Into<String>) -> Self
fn id(self, id: impl Into<String>) -> Self
[create
]