pub struct IdRegistry { /* private fields */ }Implementations§
Source§impl IdRegistry
impl IdRegistry
pub fn new() -> Self
Sourcepub fn new_index_serialno(&mut self) -> u32
pub fn new_index_serialno(&mut self) -> u32
sphinx env.new_serialno(‘index’): returns the current value and increments (serials start at 0 per document).
Sourcepub fn sphinx_make_id(&mut self, prefix: &str, term: &str) -> String
pub fn sphinx_make_id(&mut self, prefix: &str, term: &str) -> String
sphinx util.nodes.make_id(env, document, prefix, term) (:610-637),
both prefix regimes:
- non-empty prefix: candidate
_make_id(f'{prefix}-{term}'), rejected when it collapses to just the prefix, then serial fallbackf'{prefix}-{env.new_serialno(prefix)}'until the id is free; - EMPTY prefix (the py domain’s object ids,
domains/python/ _object.py:420):idformatbecomes(id_prefix or 'id') + '%s'with the Sphinx-pinnedid_prefix='', so the candidate is the bare_make_id(term)— dots, underscores and capitals survive, makingmymod.C.methits own node id — rejected when empty, and the serial fallback isid{n}(id0,id1, …) with the counter still keyed by the empty prefix.
Sphinx does NOT register the result in document.ids here —
note_explicit_target → document.set_id does, which is
Self::note_explicit_id.
Sourcepub fn note_explicit_id(&mut self, id: &str)
pub fn note_explicit_id(&mut self, id: &str)
docutils document.set_id for a node that already carries ids
(nodes.py:1832-1843): registration only — the duplicate-id ERROR
path cannot fire for the ids Self::sphinx_make_id hands out,
which are chosen to be free.
Sourcepub fn set_id_implicit(
&mut self,
node: &mut Node,
line: u32,
source: &str,
) -> Option<Node>
pub fn set_id_implicit( &mut self, node: &mut Node, line: u32, source: &str, ) -> Option<Node>
Register an implicit target (section). On duplicate: INFO/1 message
(placed by the caller inside the new section after its title), new
node dupname’d immediately, old node queued for
apply_dupname_fixups.
Sourcepub fn set_id_explicit(
&mut self,
node: &mut Node,
line: u32,
source: &str,
internal: bool,
refuri: Option<&str>,
) -> Option<Node>
pub fn set_id_explicit( &mut self, node: &mut Node, line: u32, source: &str, internal: bool, refuri: Option<&str>, ) -> Option<Node>
Register an explicit target (.. _name: forms). On duplicate:
WARNING/2; backrefs appear on the message only for internal targets
(probe-verified: external/refuri duplicates carry no backrefs).
Sourcepub fn set_id_anonymous(&mut self, node: &mut Node)
pub fn set_id_anonymous(&mut self, node: &mut Node)
Register an anonymous target: always an auto id, never a name.
Sourcepub fn allocate_auto_id(&mut self) -> String
pub fn allocate_auto_id(&mut self) -> String
Allocate a bare auto id (idN) — used by the inline parser for
problematic/system_message pairs.
pub fn take_fixups(&mut self) -> Vec<DupnameFixup>
Sourcepub fn nameids_snapshot(&self) -> Vec<(String, Option<String>, bool)>
pub fn nameids_snapshot(&self) -> Vec<(String, Option<String>, bool)>
Snapshot of the name->id table for downstream consumers (wave 4’s
std-domain label harvest) that need name -> (id, explicit) after
this registry itself is dropped: (name, id, explicit). id is
None once a name has been duplicated away (see Self::register).
Sourcepub fn index_serial(&self) -> u32
pub fn index_serial(&self) -> u32
Current value of the env.new_serialno('index') counter (see
Self::new_index_serialno).
Trait Implementations§
Source§impl Debug for IdRegistry
impl Debug for IdRegistry
Source§impl Default for IdRegistry
impl Default for IdRegistry
Source§fn default() -> IdRegistry
fn default() -> IdRegistry
Auto Trait Implementations§
impl Freeze for IdRegistry
impl RefUnwindSafe for IdRegistry
impl Send for IdRegistry
impl Sync for IdRegistry
impl Unpin for IdRegistry
impl UnsafeUnpin for IdRegistry
impl UnwindSafe for IdRegistry
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more