pub struct Party {
pub id: String,
pub metadata: HashMap<String, Value>,
}Expand description
Party in a transaction (TAIP-6).
Parties are identified using an IRI as the @id attribute in a JSON-LD object. They represent real-world entities (legal or natural persons) that are parties to a transaction.
Fields§
§id: StringIRI of the party (DID, email, phone number, etc).
metadata: HashMap<String, Value>Additional JSON-LD metadata for the party. This allows for extensible metadata like country codes, LEI codes, MCC codes, etc. Example: {“https://schema.org/addressCountry”: “de”, “lei”: “…”}
Implementations§
Source§impl Party
impl Party
Sourcepub fn with_metadata(id: &str, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(id: &str, metadata: HashMap<String, Value>) -> Self
Create a new party with metadata.
Sourcepub fn add_metadata(&mut self, key: String, value: Value)
pub fn add_metadata(&mut self, key: String, value: Value)
Add a metadata field to the party.
Sourcepub fn with_country(self, country_code: &str) -> Self
pub fn with_country(self, country_code: &str) -> Self
Add country code metadata.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get a metadata value by key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Party
impl<'de> Deserialize<'de> for Party
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
Source§impl TapParticipant for Party
impl TapParticipant for Party
impl StructuralPartialEq for Party
Auto Trait Implementations§
impl Freeze for Party
impl RefUnwindSafe for Party
impl Send for Party
impl Sync for Party
impl Unpin for Party
impl UnwindSafe for Party
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