pub struct PyDomainData {
pub objects: Vec<(String, PyObjectEntry)>,
pub objects_index: BTreeMap<String, usize>,
pub modules: Vec<(String, PyModuleEntry)>,
pub modules_index: BTreeMap<String, usize>,
}Expand description
Python-domain (py) registries: domaindata['py']['objects'] and
['modules'].
INSERTION-ORDERED, not a plain BTreeMap: Sphinx’s fuzzy resolution
pass iterates the objects dict in insertion order
(__init__.py:901-908) and ambiguity takes the FIRST match, with the
candidates listed in match order — lexicographic iteration would
diverge on both the resolved target and the warning bytes whenever
registration order isn’t alphabetical. Registration order is the
docname-ordered merge, record order within a document — and Python
dict assignment on an existing key keeps the original insertion slot,
so every overwrite here is in place (probe: a :canonical: alias
registered between two real definitions keeps its middle slot after
the second definition overwrites it).
The side *_index maps give O(log n) exact lookup; they always name
the entry’s position in the paired Vec and carry no information of
their own.
Fields§
§objects: Vec<(String, PyObjectEntry)>fullname -> entry, in registration order.
objects_index: BTreeMap<String, usize>fullname -> index into Self::objects.
modules: Vec<(String, PyModuleEntry)>modname -> entry, in registration order.
modules_index: BTreeMap<String, usize>modname -> index into Self::modules.
Implementations§
Source§impl PyDomainData
impl PyDomainData
Sourcepub fn note_object(
&mut self,
name: &str,
entry: PyObjectEntry,
) -> Option<String>
pub fn note_object( &mut self, name: &str, entry: PyObjectEntry, ) -> Option<String>
PythonDomain.note_object (__init__.py:780-813). Returns the
docname of the entry the caller must warn about — Some exactly
when Sphinx’s logger.warning fires. The aliased-vs-real matrix
(each cell probe-verified against sphinx 9.1.0):
| existing \ new | real | aliased |
|---|---|---|
| real | warn + overwrite | silent keep (no write) |
| aliased | silent overwrite | warn + overwrite |
Overwrites land in place (Python dict assignment keeps the original insertion slot).
Sourcepub fn note_module(&mut self, name: &str, entry: PyModuleEntry)
pub fn note_module(&mut self, name: &str, entry: PyModuleEntry)
PythonDomain.note_module (__init__.py:819-832) — an
unconditional dict assignment: never warns, last value wins, an
existing name keeps its insertion slot. (The duplicate-module
warning comes from the note_object(modname, 'module', ...) call
PyModule.run makes alongside this one.)
Sourcepub fn clear_doc(&mut self, docname: &str)
pub fn clear_doc(&mut self, docname: &str)
PythonDomain.clear_doc (__init__.py:744-751): drop every entry
the document owns. Survivors keep their relative order — deleting
from a Python dict never reorders what stays — and the indices are
rebuilt to match.
Sourcepub fn merge(&mut self, other: &PyDomainData, docnames: &BTreeSet<String>)
pub fn merge(&mut self, other: &PyDomainData, docnames: &BTreeSet<String>)
PythonDomain.merge_domaindata (__init__.py:753-757): fold in
other’s entries whose docname is in docnames, in other’s
registration order. Like Sphinx’s, this is a plain dict assignment
per entry — no duplicate checks (“XXX check duplicates?”), an
existing name is overwritten in place, a new one appended.
Trait Implementations§
Source§impl Clone for PyDomainData
impl Clone for PyDomainData
Source§fn clone(&self) -> PyDomainData
fn clone(&self) -> PyDomainData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PyDomainData
impl Debug for PyDomainData
Source§impl Default for PyDomainData
impl Default for PyDomainData
Source§fn default() -> PyDomainData
fn default() -> PyDomainData
Source§impl<'de> Deserialize<'de> for PyDomainData
impl<'de> Deserialize<'de> for PyDomainData
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>,
Source§impl PartialEq for PyDomainData
impl PartialEq for PyDomainData
Source§impl Serialize for PyDomainData
impl Serialize for PyDomainData
impl StructuralPartialEq for PyDomainData
Auto Trait Implementations§
impl Freeze for PyDomainData
impl RefUnwindSafe for PyDomainData
impl Send for PyDomainData
impl Sync for PyDomainData
impl Unpin for PyDomainData
impl UnsafeUnpin for PyDomainData
impl UnwindSafe for PyDomainData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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