PythonMonkey   v1.0.0 (dev)
Loading...
Searching...
No Matches
PyEventLoop::Future Struct Reference

C++ wrapper for Python asyncio.Future class. More...

#include <PyEventLoop.hh>

Public Member Functions

 Future (PyObject *future)
 
 Future (const Future &old)=delete
 
 Future (Future &&old)
 
 ~Future ()
 
void setResult (PyObject *result)
 Mark the Future as done and set its result.
 
void setException (PyObject *exception)
 Mark the Future as done and set an exception.
 
void addDoneCallback (PyObject *cb)
 Add a callback to be run when the Future is done.
 
bool isCancelled ()
 Return True if the Future is cancelled.
 
PyObject * getResult ()
 Get the result of the Future. Would raise exception if the Future is pending, cancelled, or having an exception set.
 
PyObject * getException ()
 Get the exception object that was set on this Future, or Py_None if no exception was set. Would raise an exception if the Future is pending or cancelled.
 
PyObject * getFutureObject () const
 Get the underlying asyncio.Future Python object.
 

Protected Attributes

PyObject * _future
 

Detailed Description

C++ wrapper for Python asyncio.Future class.

See also
https://docs.python.org/3/library/asyncio-future.html#asyncio.Future

Constructor & Destructor Documentation

◆ Future() [1/3]

PyEventLoop::Future::Future ( PyObject *  future)
explicit

◆ Future() [2/3]

PyEventLoop::Future::Future ( const Future old)
delete

◆ Future() [3/3]

PyEventLoop::Future::Future ( Future &&  old)

◆ ~Future()

PyEventLoop::Future::~Future ( )

Member Function Documentation

◆ addDoneCallback()

void PyEventLoop::Future::addDoneCallback ( PyObject *  cb)

◆ getException()

PyObject * PyEventLoop::Future::getException ( )

Get the exception object that was set on this Future, or Py_None if no exception was set. Would raise an exception if the Future is pending or cancelled.

See also
https://docs.python.org/3.9/library/asyncio-future.html#asyncio.Future.exception

◆ getFutureObject()

PyObject * PyEventLoop::Future::getFutureObject ( ) const

Get the underlying asyncio.Future Python object.

◆ getResult()

PyObject * PyEventLoop::Future::getResult ( )

Get the result of the Future. Would raise exception if the Future is pending, cancelled, or having an exception set.

See also
https://docs.python.org/3.9/library/asyncio-future.html#asyncio.Future.result

◆ isCancelled()

bool PyEventLoop::Future::isCancelled ( )

◆ setException()

void PyEventLoop::Future::setException ( PyObject *  exception)

◆ setResult()

void PyEventLoop::Future::setResult ( PyObject *  result)

Member Data Documentation

◆ _future

PyObject* PyEventLoop::Future::_future
protected

The documentation for this struct was generated from the following files: