Struct python_ast::codegen::PythonOptions
source · pub struct PythonOptions {
pub python_namespace: String,
pub python_path: Vec<String>,
pub imports: BTreeMap<String, HashSet<String>>,
pub scope: Scope,
pub stdpython: String,
pub with_std_python: bool,
pub allow_unsafe: bool,
}
Expand description
The global context for Python compilation.
Fields§
§python_namespace: String
Python imports are mapped into a given namespace that can be changed.
python_path: Vec<String>
The default path we will search for Python modules.
imports: BTreeMap<String, HashSet<String>>
Collects all of the things we need to compile imports[module][asnames]
scope: Scope
§stdpython: String
§with_std_python: bool
§allow_unsafe: bool
Implementations§
source§impl PythonOptions
impl PythonOptions
sourcepub fn search_path<S: Into<String> + Clone + Ord + Borrow<S>>(
&self,
file: S
) -> Result<String, Box<dyn Error>>
pub fn search_path<S: Into<String> + Clone + Ord + Borrow<S>>( &self, file: S ) -> Result<String, Box<dyn Error>>
Scans the Python path for the short name given, and returns the full path. Note that it only searches for the path itself, not any subpath.
sourcepub fn load<S: Into<String> + Clone + Ord + Borrow<S>>(
&self,
module: S
) -> Result<String, Box<dyn Error>>
pub fn load<S: Into<String> + Clone + Ord + Borrow<S>>( &self, module: S ) -> Result<String, Box<dyn Error>>
Searches the Python path for the module and returns its contents.
pub fn import<S: Into<String> + Clone + Ord + Borrow<S>>( &mut self, from: S, to: S )
Trait Implementations§
source§impl Clone for PythonOptions
impl Clone for PythonOptions
source§fn clone(&self) -> PythonOptions
fn clone(&self) -> PythonOptions
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PythonOptions
impl Debug for PythonOptions
Auto Trait Implementations§
impl RefUnwindSafe for PythonOptions
impl Send for PythonOptions
impl Sync for PythonOptions
impl Unpin for PythonOptions
impl UnwindSafe for PythonOptions
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
Mutably borrows from an owned value. Read more