Skip to main content

Settings

Struct Settings 

Source
#[non_exhaustive]
pub struct Settings {
Show 32 fields pub isolated: bool, pub dev_mode: bool, pub install_signal_handlers: bool, pub hash_seed: Option<u32>, pub faulthandler: bool, pub code_debug_ranges: bool, pub argv: Vec<String>, pub xoptions: Vec<(String, Option<String>)>, pub warnoptions: Vec<String>, pub import_site: bool, pub bytes_warning: u64, pub warn_default_encoding: bool, pub thread_inherit_context: bool, pub context_aware_warnings: bool, pub inspect: bool, pub interactive: bool, pub write_bytecode: bool, pub verbose: u8, pub quiet: bool, pub user_site_directory: bool, pub buffered_stdio: bool, pub stdio_encoding: Option<String>, pub stdio_errors: Option<String>, pub utf8_mode: i8, pub check_hash_pycs_mode: CheckHashPycsMode, pub safe_path: bool, pub int_max_str_digits: i64, pub path_list: Vec<String>, pub debug: u8, pub optimize: u8, pub ignore_environment: bool, pub allow_external_library: bool,
}
Expand description

User-configurable settings for the python vm.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§isolated: bool

-I

§dev_mode: bool

-Xdev

§install_signal_handlers: bool

Not set SIGINT handler(i.e. for embedded mode)

§hash_seed: Option<u32>

PYTHONHASHSEED=x None means use_hash_seed = 0 in CPython

§faulthandler: bool

-X faulthandler, PYTHONFAULTHANDLER

§code_debug_ranges: bool

-X no_debug_ranges: disable column info in bytecode

§argv: Vec<String>

sys.argv

§xoptions: Vec<(String, Option<String>)>

-Xfoo[=bar]

§warnoptions: Vec<String>

-Wfoo

§import_site: bool

-S

§bytes_warning: u64

-b

§warn_default_encoding: bool

-X warn_default_encoding, PYTHONWARNDEFAULTENCODING

§thread_inherit_context: bool

-X thread_inherit_context, whether new threads inherit context from parent

§context_aware_warnings: bool

-X context_aware_warnings, whether warnings are context aware

§inspect: bool

-i

§interactive: bool

-i, with no script

§write_bytecode: bool

-B

§verbose: u8

verbosity level (-v switch)

§quiet: bool

-q

§user_site_directory: bool

-s

§buffered_stdio: bool

-u, PYTHONUNBUFFERED=x

§stdio_encoding: Option<String>

PYTHONIOENCODING - stdio encoding

§stdio_errors: Option<String>

PYTHONIOENCODING - stdio error handler

§utf8_mode: i8§check_hash_pycs_mode: CheckHashPycsMode

–check-hash-based-pycs

§safe_path: bool

-P

§int_max_str_digits: i64

-X int_max_str_digits

§path_list: Vec<String>

Environment PYTHONPATH (and RUSTPYTHONPATH)

§debug: u8

-d command line switch

§optimize: u8

-O optimization switch counter

§ignore_environment: bool

-E

§allow_external_library: bool

false for wasm. Not a command-line option

Implementations§

Source§

impl Settings

Source

pub fn with_path(self, path: String) -> Self

Trait Implementations§

Source§

impl Default for Settings

Sensible default settings.

Source§

fn default() -> Self

Returns the “default value” for a type. 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, U> ExactFrom<T> for U
where U: TryFrom<T>,

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

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, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

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

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U

Source§

impl<T> PyThreadingConstraint for T