pub struct Relationships { /* private fields */ }Expand description
一个 .rels 文件对应的全部关系集合。
内部以 Vec<Relationship> 保留插入顺序,同时维护 by_id 索引
提供 O(log n) 的按 id 查询。
Implementations§
Source§impl Relationships
impl Relationships
Sourcepub fn new() -> Relationships
pub fn new() -> Relationships
空集合。
Sourcepub fn add(&mut self, r: Relationship) -> Result<&Relationship, Error>
pub fn add(&mut self, r: Relationship) -> Result<&Relationship, Error>
Sourcepub fn iter(&self) -> impl Iterator<Item = &Relationship>
pub fn iter(&self) -> impl Iterator<Item = &Relationship>
取所有关系(按插入顺序)。
Sourcepub fn get(&self, id: &str) -> Option<&Relationship>
pub fn get(&self, id: &str) -> Option<&Relationship>
按 ID 找。
Sourcepub fn of_type<'a>(
&'a self,
t: RelType,
) -> impl Iterator<Item = &'a Relationship> + 'a
pub fn of_type<'a>( &'a self, t: RelType, ) -> impl Iterator<Item = &'a Relationship> + 'a
按 reltype 过滤。
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