Skip to main content

IdRegistry

Struct IdRegistry 

Source
pub struct IdRegistry { /* private fields */ }

Implementations§

Source§

impl IdRegistry

Source

pub fn new() -> Self

Source

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).

Source

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 fallback f'{prefix}-{env.new_serialno(prefix)}' until the id is free;
  • EMPTY prefix (the py domain’s object ids, domains/python/ _object.py:420): idformat becomes (id_prefix or 'id') + '%s' with the Sphinx-pinned id_prefix='', so the candidate is the bare _make_id(term) — dots, underscores and capitals survive, making mymod.C.meth its own node id — rejected when empty, and the serial fallback is id{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.

Source

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.

Source

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.

Source

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).

Source

pub fn set_id_anonymous(&mut self, node: &mut Node)

Register an anonymous target: always an auto id, never a name.

Source

pub fn allocate_auto_id(&mut self) -> String

Allocate a bare auto id (idN) — used by the inline parser for problematic/system_message pairs.

Source

pub fn take_fixups(&mut self) -> Vec<DupnameFixup>

Source

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).

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IdRegistry

Source§

fn default() -> IdRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.