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: boolpython_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: boolpython_display_short_literal_types
(domains/python/__init__.py:1120-1122): render Literal['a', 'b']
as 'a' | 'b'.
python_use_unqualified_type_names: boolpython_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: booltoc_object_entries (config.py:250): whether object descriptions
get _toc_name/_toc_parts and therefore TOC entries at all.
toc_object_entries_show_parents: Stringtoc_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: booladd_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: booladd_module_names (config.py:249): whether a signature’s module
prefix is rendered in desc_addname.
strip_signature_backslash: boolstrip_signature_backslash (directives/__init__.py:370-372):
strip backslashes from a signature before it is measured and parsed.
Implementations§
Source§impl PySigConfig
impl PySigConfig
Sourcepub fn max_len(&self) -> i64
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
impl Clone for PySigConfig
Source§fn clone(&self) -> PySigConfig
fn clone(&self) -> PySigConfig
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 PySigConfig
impl Debug for PySigConfig
Source§impl Default for PySigConfig
impl Default for PySigConfig
impl Eq for PySigConfig
Source§impl From<&BuildConfig> for PySigConfig
impl From<&BuildConfig> for PySigConfig
Source§fn from(config: &BuildConfig) -> Self
fn from(config: &BuildConfig) -> Self
Source§impl PartialEq for PySigConfig
impl PartialEq for PySigConfig
impl StructuralPartialEq for PySigConfig
Auto Trait Implementations§
impl Freeze for PySigConfig
impl RefUnwindSafe for PySigConfig
impl Send for PySigConfig
impl Sync for PySigConfig
impl Unpin for PySigConfig
impl UnsafeUnpin for PySigConfig
impl UnwindSafe for PySigConfig
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