pub struct PyCode(/* private fields */);
Expand description
Represents a Python code object.
Values of this type are accessed via PyO3’s smart pointers, e.g. as
Py<PyCode>
or Bound<'py, PyCode>
.
Implementations§
Source§impl PyCode
impl PyCode
Sourcepub fn compile<'py>(
py: Python<'py>,
code: &CStr,
filename: &CStr,
input: PyCodeInput,
) -> PyResult<Bound<'py, PyCode>>
pub fn compile<'py>( py: Python<'py>, code: &CStr, filename: &CStr, input: PyCodeInput, ) -> PyResult<Bound<'py, PyCode>>
Compiles code in the given context.
input
decides whether code
is treated as
PyCodeInput::Eval
: an isolated expressionPyCodeInput::File
: a sequence of statements
Trait Implementations§
Source§impl PyTypeCheck for PyCode
Available on Py_LIMITED_API
or PyPy
only.
impl PyTypeCheck for PyCode
Available on
Py_LIMITED_API
or PyPy
only.impl DerefToPyAny for PyCode
Auto Trait Implementations§
impl !Freeze for PyCode
impl !RefUnwindSafe for PyCode
impl !Send for PyCode
impl !Sync for PyCode
impl Unpin for PyCode
impl UnwindSafe for PyCode
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