pub struct PmiState {
pub views: Vec<PmiView>,
pub id_counter: u64,
}Expand description
The document’s pmi block.
Fields§
§views: Vec<PmiView>§id_counter: u64Mints every view AND annotation id (VIEW{n}, DIM{n}, …); monotonic,
never reused, re-seeded from the largest numeric suffix on load.
Implementations§
Source§impl PmiState
impl PmiState
Sourcepub fn next_id(&mut self, prefix: &str) -> String
pub fn next_id(&mut self, prefix: &str) -> String
Mint the next id with prefix (VIEW → VIEW3). The counter is
re-seeded first from the largest numeric suffix already in the block,
so an edited or merged document never hands out a colliding id.
pub fn find_view(&self, id: &str) -> Option<&PmiView>
pub fn find_view_mut(&mut self, id: &str) -> Option<&mut PmiView>
Sourcepub fn find_annotation(&self, id: &str) -> Option<(&PmiView, &PmiAnnotation)>
pub fn find_annotation(&self, id: &str) -> Option<(&PmiView, &PmiAnnotation)>
The annotation with id and its owning view.
Sourcepub fn locate_annotation(&self, id: &str) -> Option<(usize, usize)>
pub fn locate_annotation(&self, id: &str) -> Option<(usize, usize)>
The owning view id and index of annotation id.
pub fn find_annotation_mut(&mut self, id: &str) -> Option<&mut PmiAnnotation>
Sourcepub fn datum_letters(&self) -> Vec<(String, String)>
pub fn datum_letters(&self) -> Vec<(String, String)>
Every datum letter defined in the part (any view), in definition order, with the defining annotation’s id — the part-level datum registry a feature control frame validates its references against.
Sourcepub fn next_datum_letter(&self) -> Option<String>
pub fn next_datum_letter(&self) -> Option<String>
The next unused datum letter: A–Z skipping I, O and Q (ASME Y14.5),
then AA, AB, … (None only past ZZ).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PmiState
impl<'de> Deserialize<'de> for PmiState
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
impl StructuralPartialEq for PmiState
Auto Trait Implementations§
impl Freeze for PmiState
impl RefUnwindSafe for PmiState
impl Send for PmiState
impl Sync for PmiState
impl Unpin for PmiState
impl UnsafeUnpin for PmiState
impl UnwindSafe for PmiState
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