pub struct PythonToRustTranslator { /* private fields */ }Expand description
Python to Rust code generator
Implementations§
Source§impl PythonToRustTranslator
impl PythonToRustTranslator
pub fn new() -> Self
Sourcepub fn set_imports(&mut self, imports: Vec<String>)
pub fn set_imports(&mut self, imports: Vec<String>)
Set imported modules for attribute resolution
Sourcepub fn set_aliases(&mut self, aliases: HashMap<String, String>)
pub fn set_aliases(&mut self, aliases: HashMap<String, String>)
Set module aliases (alias -> actual module name)
Sourcepub fn translate_module(&mut self, module: &PyModule) -> Result<String>
pub fn translate_module(&mut self, module: &PyModule) -> Result<String>
Translate Python module to Rust code
Sourcepub fn translate_stmt(&mut self, stmt: &PyStmt) -> Result<String>
pub fn translate_stmt(&mut self, stmt: &PyStmt) -> Result<String>
Translate Python statement to Rust
Sourcepub fn translate_expr(&mut self, expr: &PyExpr) -> Result<String>
pub fn translate_expr(&mut self, expr: &PyExpr) -> Result<String>
Translate Python expression to Rust
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PythonToRustTranslator
impl RefUnwindSafe for PythonToRustTranslator
impl Send for PythonToRustTranslator
impl Sync for PythonToRustTranslator
impl Unpin for PythonToRustTranslator
impl UnsafeUnpin for PythonToRustTranslator
impl UnwindSafe for PythonToRustTranslator
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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 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> ⓘ
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