Skip to main content

PyDomainData

Struct PyDomainData 

Source
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

Source

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 \ newrealaliased
realwarn + overwritesilent keep (no write)
aliasedsilent overwritewarn + overwrite

Overwrites land in place (Python dict assignment keeps the original insertion slot).

Source

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

Source

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.

Source

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

Source§

fn clone(&self) -> PyDomainData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PyDomainData

Source§

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

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

impl Default for PyDomainData

Source§

fn default() -> PyDomainData

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

impl<'de> Deserialize<'de> for PyDomainData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PyDomainData

Source§

fn eq(&self, other: &PyDomainData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PyDomainData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PyDomainData

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.