use crate::{builtins::PyBaseExceptionRef, PyObjectRef, PyResult, VirtualMachine};
pub trait ToPyObject {
fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef;
}
pub trait ToPyResult {
fn to_pyresult(self, vm: &VirtualMachine) -> PyResult;
}
pub trait ToPyException {
fn to_pyexception(&self, vm: &VirtualMachine) -> PyBaseExceptionRef;
}
pub trait IntoPyException {
fn into_pyexception(self, vm: &VirtualMachine) -> PyBaseExceptionRef;
}
impl<T> IntoPyException for &'_ T
where
T: ToPyException,
{
fn into_pyexception(self, vm: &VirtualMachine) -> PyBaseExceptionRef {
self.to_pyexception(vm)
}
}