Skip to main content

RegistryExport

Struct RegistryExport 

Source
pub struct RegistryExport {
    pub nameids: Vec<(String, Option<String>, bool)>,
    pub index_serial: u32,
    pub program_options: Vec<ProgramOptionRecord>,
    pub std_objects: Vec<ObjectRegistration>,
    pub py_objects: Vec<PyObjectRecord>,
    pub py_modules: Vec<PyModuleRecord>,
    pub log_warnings: Vec<ParseLogWarning>,
    pub dependencies: Vec<String>,
    pub included: Vec<String>,
}
Expand description

What the parse layer hands the environment besides the doctree itself: state that lives in the parser (the docutils id/name registry, Sphinx’s env.ref_context) and dies with it, but that env collectors need.

Named for its original single job — the document.nameids snapshot harvested from crate::doctree::ids::IdRegistry right before it drops, which wave 4’s std-domain label harvest reads. Intended to eventually ride the document cache, so it stays serde-serializable and cheap to clone.

Fields§

§nameids: Vec<(String, Option<String>, bool)>

(name, id, explicit), one entry per registered name. id is None once a name has been duplicated away.

§index_serial: u32

sphinx env.new_serialno('index') counter value at the end of the parse (shared by the index directive and index-entry-emitting roles).

§program_options: Vec<ProgramOptionRecord>

The std-domain registrations the object-description directives made while running, in document order.

Sphinx performs these from inside add_target_and_index, against state the finished doctree does not carry: the program an option belongs to comes from env.ref_context['std:program'] and is stamped on no node, and a :no-typesetting: description registers itself and then replaces its whole desc node with a bare target — so a doctree walk can neither recover the program nor see that the object existed. Recording the calls keeps the env layer exact for both.

Deliberately not #[serde(default)], for the reason crate::document::Document::registry gives: a cache entry written before this field existed must FAIL to decode so the document is re-parsed. Defaulting it to an empty vector would let a pre-desc cache decode cleanly, and every :option:/:envvar:/:confval: in the project would then dangle against an empty registry.

§std_objects: Vec<ObjectRegistration>

See Self::program_options — including why this is not #[serde(default)] either.

§py_objects: Vec<PyObjectRecord>

The py-domain object registrations (PythonDomain.note_object), in document order. Same rationale and cache-shape rule as Self::program_options: the program state analog here is the parser’s py:module/py:class ref_context, which no doctree node carries, and a :no-typesetting: py object registers and then vanishes from the tree.

§py_modules: Vec<PyModuleRecord>

The py-domain module registrations (PythonDomain.note_module), in document order. Not #[serde(default)] — see Self::program_options.

§log_warnings: Vec<ParseLogWarning>

Diagnostics the parse raised through Sphinx’s logger rather than into the tree, which have nowhere else to go: docutils turns a directive error into a system_message node, but a Sphinx directive calling logger.warning produces no node at all. They ride the export (and therefore the document cache) for the same reason ToctreeRecord::warnings does — a cache hit that skipped the parse must still reproduce them.

§dependencies: Vec<String>

Files the document pulls in at parse time (docutils settings.record_dependencies, harvested by sphinx’s DependenciesCollector): one srcdir-relative normalized path per successfully opened include target — non-doc files included, standard includes excluded (§Scope-2b). The env layer replays these into env.dependencies, which drives get_outdated_files. Not #[serde(default)] — see Self::program_options: a pre-include cache decoding with an empty list would never re-read the document when an included file changes.

§included: Vec<String>

The docnames this document textually includes (sphinx env.note_included, recorded for every include argument that maps to a docname — before the file is even opened, like sphinx). The env layer replays these into env.included, whose only consumer is the orphan check. Not #[serde(default)] — see Self::program_options.

Trait Implementations§

Source§

impl Clone for RegistryExport

Source§

fn clone(&self) -> RegistryExport

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 RegistryExport

Source§

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

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

impl Default for RegistryExport

Source§

fn default() -> RegistryExport

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

impl<'de> Deserialize<'de> for RegistryExport

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 Serialize for RegistryExport

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

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
§

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