mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
21 lines
656 B
Rust
21 lines
656 B
Rust
use crate::function::PyFuncArgs;
|
|
use crate::pyobject::{PyContext, PyResult, TypeProtocol};
|
|
use crate::vm::VirtualMachine;
|
|
|
|
pub fn init(context: &PyContext) {
|
|
extend_class!(context, &context.ellipsis_type, {
|
|
"__new__" => context.new_rustfunc(ellipsis_new),
|
|
"__repr__" => context.new_rustfunc(ellipsis_repr)
|
|
});
|
|
}
|
|
|
|
fn ellipsis_new(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
|
|
arg_check!(vm, args, required = [(_cls, None)]);
|
|
Ok(vm.ctx.ellipsis())
|
|
}
|
|
|
|
fn ellipsis_repr(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
|
|
arg_check!(vm, args, required = [(_cls, None)]);
|
|
Ok(vm.new_str("Ellipsis".to_string()))
|
|
}
|