pub struct Relationships {
pub items: Vec<Relationship>,
/* private fields */
}Expand description
A collection of relationships parsed from a .rels file.
Fields§
§items: Vec<Relationship>Implementations§
Source§impl Relationships
impl Relationships
pub fn new() -> Relationships
Sourcepub fn get_by_id(&self, id: &str) -> Option<&Relationship>
pub fn get_by_id(&self, id: &str) -> Option<&Relationship>
Find a relationship by its ID.
Sourcepub fn get_by_type(&self, rel_type: &str) -> Option<&Relationship>
pub fn get_by_type(&self, rel_type: &str) -> Option<&Relationship>
Find the first relationship matching a given type.
Sourcepub fn get_all_by_type(&self, rel_type: &str) -> Vec<&Relationship>
pub fn get_all_by_type(&self, rel_type: &str) -> Vec<&Relationship>
Find all relationships matching a given type.
Sourcepub fn add(&mut self, rel_type: &str, target: &str) -> String
pub fn add(&mut self, rel_type: &str, target: &str) -> String
Add a new relationship and return its generated ID.
Sourcepub fn add_external(&mut self, rel_type: &str, target: &str) -> String
pub fn add_external(&mut self, rel_type: &str, target: &str) -> String
Add an externally-targeted relationship (e.g. a hyperlink URL) and return its generated ID.
Sourcepub fn add_with_id(&mut self, id: &str, rel_type: &str, target: &str)
pub fn add_with_id(&mut self, id: &str, rel_type: &str, target: &str)
Add a relationship with a specific ID.
If a relationship with this ID already exists, it is replaced.
The next_id counter is updated to avoid future collisions.
Trait Implementations§
Source§impl Clone for Relationships
impl Clone for Relationships
Source§fn clone(&self) -> Relationships
fn clone(&self) -> Relationships
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Relationships
impl Debug for Relationships
Source§impl Default for Relationships
impl Default for Relationships
Source§fn default() -> Relationships
fn default() -> Relationships
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Relationships
impl RefUnwindSafe for Relationships
impl Send for Relationships
impl Sync for Relationships
impl Unpin for Relationships
impl UnsafeUnpin for Relationships
impl UnwindSafe for Relationships
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