pub struct PyRefContext {
pub module: Option<String>,
pub class_: Option<String>,
pub span: Span,
}Expand description
The slice of env.ref_context that type_to_xref copies onto every
annotation xref (_annotations.py:62-66): the enclosing py:module /
py:class, or Python None when unset — which docutils pformat renders
as the "True" sentinel (same convention as the inline parser’s role
xrefs, src/rst/inline.rs) — plus the provenance the built nodes carry.
Fields§
§module: Option<String>§class_: Option<String>§span: SpanThe span every node this context builds is stamped with: the
enclosing desc_signature‘s, i.e. the directive’s own (source, line). Sphinx gives annotation xrefs no provenance of their own,
and a resolution warning on one then locates through docutils’
get_source_line ancestor walk — which stops at the signature,
because ObjectDescription.run calls set_source_info(signode).
Stamping the signature’s span directly yields the same location
without depending on the walk, and keeps the include case exact
(an annotation inside an included file names THAT file). A
Span::ZERO (line 0) means “unstamped”, which the resolver treats
as “locate at the nearest stamped ancestor”.
Trait Implementations§
Source§impl Clone for PyRefContext
impl Clone for PyRefContext
Source§fn clone(&self) -> PyRefContext
fn clone(&self) -> PyRefContext
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 PyRefContext
impl Debug for PyRefContext
Source§impl Default for PyRefContext
impl Default for PyRefContext
Source§fn default() -> PyRefContext
fn default() -> PyRefContext
impl Eq for PyRefContext
Source§impl PartialEq for PyRefContext
impl PartialEq for PyRefContext
impl StructuralPartialEq for PyRefContext
Auto Trait Implementations§
impl Freeze for PyRefContext
impl RefUnwindSafe for PyRefContext
impl Send for PyRefContext
impl Sync for PyRefContext
impl Unpin for PyRefContext
impl UnsafeUnpin for PyRefContext
impl UnwindSafe for PyRefContext
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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