pub struct Document {
pub last_update: Option<DateTime>,
pub description: Option<String>,
/* private fields */
}
Expand description
TMF667 Document
Fields§
§last_update: Option<DateTime>
For trait HasLastUpdate
description: Option<String>
Description of document
Implementations§
Source§impl Document
impl Document
Sourcepub fn new(name: impl Into<String>) -> Document
pub fn new(name: impl Into<String>) -> Document
Create a new document
Examples found in repository?
examples/create_document.rs (line 9)
6fn main() {
7 let agreement = Agreement::new("My Aggreement");
8
9 let doc = Document::new("My Document")
10 .doc_type("PDF")
11 .link(agreement);
12
13
14 // doc.link_entity(agreement);
15
16 dbg!(doc);
17}
Sourcepub fn attachment(self, attachment: AttachmentRefOrValue) -> Document
pub fn attachment(self, attachment: AttachmentRefOrValue) -> Document
Set the attachment for this document.
Sourcepub fn doc_type(self, type: impl Into<String>) -> Document
pub fn doc_type(self, type: impl Into<String>) -> Document
Set the document type
use tmflib::tmf667::document::Document;
let doc = Document::new("My Document")
.doc_type("PDF");
Examples found in repository?
examples/create_document.rs (line 10)
6fn main() {
7 let agreement = Agreement::new("My Aggreement");
8
9 let doc = Document::new("My Document")
10 .doc_type("PDF")
11 .link(agreement);
12
13
14 // doc.link_entity(agreement);
15
16 dbg!(doc);
17}
Sourcepub fn link<T: HasName>(self, entity: T) -> Document
pub fn link<T: HasName>(self, entity: T) -> Document
Link another TMF entity during creation
Examples found in repository?
examples/create_document.rs (line 11)
6fn main() {
7 let agreement = Agreement::new("My Aggreement");
8
9 let doc = Document::new("My Document")
10 .doc_type("PDF")
11 .link(agreement);
12
13
14 // doc.link_entity(agreement);
15
16 dbg!(doc);
17}
Sourcepub fn link_entity<T: HasName>(&mut self, entity: T)
pub fn link_entity<T: HasName>(&mut self, entity: T)
Link another TMF entity into this document
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
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 From<&Document> for AttachmentRefOrValue
impl From<&Document> for AttachmentRefOrValue
Source§impl From<AttachmentRefOrValue> for Document
impl From<AttachmentRefOrValue> for Document
Source§fn from(value: AttachmentRefOrValue) -> Self
fn from(value: AttachmentRefOrValue) -> Self
Converts to this type from the input type.
Source§impl HasDescription for Document
impl HasDescription for Document
Source§fn description(self, description: impl Into<String>) -> Self
fn description(self, description: impl Into<String>) -> Self
Builder pattern function to set the description on object creation
Source§fn get_description(&self) -> String
fn get_description(&self) -> String
Get the description by cloning it if set, returns empty string otherwise.
Source§impl HasId for Document
impl HasId for Document
Source§fn generate_id(&mut self)
fn generate_id(&mut self)
Generate and store a new ID. This will also regenerated the HREF field via generate_href()
Source§fn generate_href(&mut self)
fn generate_href(&mut self)
Generate a new HTML reference. Read more
Source§fn get_class() -> String
fn get_class() -> String
Get the class of this object. This is also used to form part of the URL via generate_href()
Source§fn get_class_href() -> String
fn get_class_href() -> String
Get Class HREF, this represents the generate path to the class.
Source§fn get_mod_path() -> String
fn get_mod_path() -> String
Get the module path
Source§fn set_id(&mut self, id: impl Into<String>)
fn set_id(&mut self, id: impl Into<String>)
Set the id on the object, also triggers generate_href().
Source§impl HasLastUpdate for Document
impl HasLastUpdate for Document
Source§fn set_last_update(&mut self, time: impl Into<String>)
fn set_last_update(&mut self, time: impl Into<String>)
Store a timestamp into last_update field (if available)
Source§fn last_update(self, time: Option<String>) -> Self
fn last_update(self, time: Option<String>) -> Self
Builder pattern for setting lastUpdate on create
If time is None, current time is used via [‘get_timestamp()’]
Source§fn get_timestamp() -> String
fn get_timestamp() -> String
Geneate a timestamp for now(), useful for updating last_updated fields
Source§fn create_with_time() -> Self
fn create_with_time() -> Self
Create a new TMF object, also set last_update field to now()
Source§impl HasName for Document
impl HasName for Document
Source§impl HasRelatedParty for Document
impl HasRelatedParty for Document
Source§fn add_party(&mut self, party: RelatedParty)
fn add_party(&mut self, party: RelatedParty)
Add a new party
Source§fn remove_party(&mut self, idx: usize) -> Result<RelatedParty, String>
fn remove_party(&mut self, idx: usize) -> Result<RelatedParty, String>
Remote a party
Source§fn get_by_role(&self, role: String) -> Option<Vec<&RelatedParty>>
fn get_by_role(&self, role: String) -> Option<Vec<&RelatedParty>>
Get a list of RelatedParty entries by role
Source§fn party(self, party: RelatedParty) -> Self
fn party(self, party: RelatedParty) -> Self
Builder pattern to add a party on create
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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