pub struct ElementPath { /* private fields */ }Implementations§
Source§impl ElementPath
impl ElementPath
pub fn new(path: &str) -> Self
Sourcepub fn from_parts(parts: Vec<String>) -> Self
pub fn from_parts(parts: Vec<String>) -> Self
Constructs an ElementPath from a vector of parts.
This is more efficient than new() when you already have the parts vector,
as it avoids the split operation. Useful when converting from parent() results.
§Example
use rh_foundation::snapshot::ElementPath;
let path = ElementPath::new("Patient.name.given");
let parent_parts = path.parent().unwrap();
let parent_path = ElementPath::from_parts(parent_parts.to_vec());
assert_eq!(parent_path.as_str(), "Patient.name");pub fn parts(&self) -> &[String]
pub fn as_str(&self) -> &str
pub fn depth(&self) -> usize
pub fn is_parent_of(&self, other: &ElementPath) -> bool
pub fn is_child_of(&self, other: &ElementPath) -> bool
pub fn is_immediate_child_of(&self, parent: &ElementPath) -> bool
Sourcepub fn parent(&self) -> Option<&[String]>
pub fn parent(&self) -> Option<&[String]>
Returns a slice view of the parent path’s parts.
This is a zero-allocation operation that returns a borrowed slice.
If you need an ElementPath instance, use ElementPath::from_parts(parent.to_vec()).
§Returns
Some(&[String])- A slice containing the parent’s path partsNone- If this is a root element (depth <= 1)
§Example
use rh_foundation::snapshot::ElementPath;
let path = ElementPath::new("Patient.name.given");
let parent_parts = path.parent().unwrap();
assert_eq!(parent_parts, &["Patient", "name"]);
// Convert to ElementPath if needed
let parent_path = ElementPath::from_parts(parent_parts.to_vec());
assert_eq!(parent_path.as_str(), "Patient.name");pub fn matches_choice_type(&self, base_path: &ElementPath) -> bool
pub fn normalize_choice_type(&self) -> ElementPath
pub fn is_slice(&self) -> bool
pub fn slice_name(&self) -> Option<&str>
pub fn base_path(&self) -> ElementPath
pub fn is_reslice(&self) -> bool
pub fn parent_slice(&self) -> Option<ElementPath>
Trait Implementations§
Source§impl Clone for ElementPath
impl Clone for ElementPath
Source§fn clone(&self) -> ElementPath
fn clone(&self) -> ElementPath
Returns a duplicate of the value. Read more
1.0.0 · 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 ElementPath
impl Debug for ElementPath
Source§impl PartialEq for ElementPath
impl PartialEq for ElementPath
impl Eq for ElementPath
impl StructuralPartialEq for ElementPath
Auto Trait Implementations§
impl Freeze for ElementPath
impl RefUnwindSafe for ElementPath
impl Send for ElementPath
impl Sync for ElementPath
impl Unpin for ElementPath
impl UnsafeUnpin for ElementPath
impl UnwindSafe for ElementPath
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