Skip to main content

PySigConfig

Struct PySigConfig 

Source
pub struct PySigConfig {
    pub maximum_signature_line_length: Option<i64>,
    pub python_maximum_signature_line_length: Option<i64>,
    pub python_trailing_comma_in_multi_line_signatures: bool,
    pub python_display_short_literal_types: bool,
    pub python_use_unqualified_type_names: bool,
    pub toc_object_entries: bool,
    pub toc_object_entries_show_parents: String,
    pub add_function_parentheses: bool,
    pub add_module_names: bool,
    pub strip_signature_backslash: bool,
}
Expand description

The object-signature / py-domain configuration the read phase consumes, lifted out of crate::config::BuildConfig so the parser depends on ten values instead of the whole build configuration.

Sphinx registers these across two files — sphinx/config.py:248-281 for the four domain-agnostic keys and sphinx/directives/__init__.py:370-372 for strip_signature_backslash, sphinx/domains/python/__init__.py: 1105-1122 for the python_* family — and every one of them is rebuild category 'env' (research spec §7), i.e. a read-phase input whose change invalidates every parsed document.

modindex_common_prefix is deliberately not here: it is consumed by the python module index at write time, not by the parse layer.

Fields§

§maximum_signature_line_length: Option<i64>

maximum_signature_line_length (config.py:279-281), the global wrap threshold shared by the py/js/c/cpp domains. See Self::max_len.

§python_maximum_signature_line_length: Option<i64>

python_maximum_signature_line_length (domains/python/__init__.py:1108-1113), the py-domain override.

§python_trailing_comma_in_multi_line_signatures: bool

python_trailing_comma_in_multi_line_signatures (domains/python/__init__.py:1114-1119): the multi_line_trailing_comma attribute on a wrapped desc_parameterlist.

§python_display_short_literal_types: bool

python_display_short_literal_types (domains/python/__init__.py:1120-1122): render Literal['a', 'b'] as 'a' | 'b'.

§python_use_unqualified_type_names: bool

python_use_unqualified_type_names (domains/python/__init__.py:1105-1107): emit a pending_xref_condition pair so the resolver can show the last dotted segment of a resolved annotation.

§toc_object_entries: bool

toc_object_entries (config.py:250): whether object descriptions get _toc_name/_toc_parts and therefore TOC entries at all.

§toc_object_entries_show_parents: String

toc_object_entries_show_parents (config.py:251-253), an ENUM('domain', 'all', 'hide'). Kept as the raw string because Sphinx only warns about an unrecognised value and carries it through unchanged — see crate::config::BuildConfig::validate.

§add_function_parentheses: bool

add_function_parentheses (config.py:248), consumed by XRefRole.update_title_and_target for the fix_parens roles (:py:func:, :py:meth:) and by the _toc_name parens gate.

§add_module_names: bool

add_module_names (config.py:249): whether a signature’s module prefix is rendered in desc_addname.

§strip_signature_backslash: bool

strip_signature_backslash (directives/__init__.py:370-372): strip backslashes from a signature before it is measured and parsed.

Implementations§

Source§

impl PySigConfig

Source

pub fn max_len(&self) -> i64

The resolved wrap threshold PyObject.handle_signature computes (domains/python/_object.py:291-295):

max_len = (
    self.config.python_maximum_signature_line_length
    or self.config.maximum_signature_line_length
    or 0
)

or tests truthiness, not None-ness. A py-specific 0 is therefore not “wrap everything”: it is falsy and falls through to the global key (research spec §1.2, probe C4 — python=0, global=1 wraps at 1). The > max_len > 0 guard at the call site is what makes a resolved 0 mean “feature off”.

Trait Implementations§

Source§

impl Clone for PySigConfig

Source§

fn clone(&self) -> PySigConfig

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 PySigConfig

Source§

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

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

impl Default for PySigConfig

Source§

fn default() -> Self

Sphinx 9.1.0’s own defaults, probe-verified (task-2 brief, “Probe outcomes”), so a parse with no project behind it behaves like a default Sphinx project.

Source§

impl Eq for PySigConfig

Source§

impl From<&BuildConfig> for PySigConfig

Source§

fn from(config: &BuildConfig) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PySigConfig

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PySigConfig

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.