pub struct InstanceOccurrence { /* private fields */ }Expand description
Retains one occurrence’s identity, immediate parent, and local mapping ranges.
Parent/site pairs distinguish repeated uses of shared children. Root occurrences have neither a parent nor an inclusion site. No record owns another record.
use adam_rs::{Sheet, TemplateBuilder};
let template = TemplateBuilder::new().finish()?;
let instance = template.instantiate(&mut Sheet::new(), &[])?;
let root = &instance.occurrences()[0];
assert_eq!(root.template(), &template.id());
assert!(root.parent().is_none());
assert!(root.inclusion_site().is_none());
assert_eq!(instance.occurrence(root.id()).unwrap().id(), root.id());Implementations§
Source§impl InstanceOccurrence
impl InstanceOccurrence
Sourcepub fn conditionals(&self) -> &[ConditionalId]
pub fn conditionals(&self) -> &[ConditionalId]
Borrows live conditional identities in this definition’s authored order.
These identities remain usable after the template is dropped.
§Examples
let template = adam_rs::TemplateBuilder::new().finish()?;
let instance = template.instantiate(&mut adam_rs::Sheet::new(), &[])?;
assert!(instance.occurrences()[0].conditionals().is_empty());Sourcepub fn id(&self) -> &OccurrenceId
pub fn id(&self) -> &OccurrenceId
Sourcepub fn template(&self) -> &TemplateId
pub fn template(&self) -> &TemplateId
Sourcepub fn parent(&self) -> Option<&OccurrenceId>
pub fn parent(&self) -> Option<&OccurrenceId>
Borrows the immediate parent identity, or returns None for the root.
§Examples
See the occurrence example.
Sourcepub fn inclusion_site(&self) -> Option<&RelationshipSlot>
pub fn inclusion_site(&self) -> Option<&RelationshipSlot>
Borrows the inclusion group in the parent’s namespace, or returns None for the root.
§Examples
See the occurrence example.
Trait Implementations§
Auto Trait Implementations§
impl !Send for InstanceOccurrence
impl !Sync for InstanceOccurrence
impl Freeze for InstanceOccurrence
impl RefUnwindSafe for InstanceOccurrence
impl Unpin for InstanceOccurrence
impl UnsafeUnpin for InstanceOccurrence
impl UnwindSafe for InstanceOccurrence
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