Struct PySource
pub(crate) struct PySource {
object: Py<PyAny>,
name: String,
}Expand description
A Python object as a source: whichever of fetch, recipes, calendars
it has. Each call takes the GIL; an exception it raises becomes a
SourceError naming the object’s type.
Fields§
§object: Py<PyAny>§name: StringImplementations§
§impl PySource
impl PySource
pub(crate) fn new(object: &Bound<'_, PyAny>) -> PyResult<Self>
pub(crate) fn has(&self, py: Python<'_>, method: &str) -> bool
fn failed(&self, py: Python<'_>, e: &PyErr) -> SourceError
fn malformed(&self, detail: impl Into<String>) -> SourceError
fn call<'py>(
&self,
py: Python<'py>,
method: &str,
args: impl IntoPy<Py<PyTuple>>,
) -> Result<Bound<'py, PyAny>, SourceError>
fn call<'py>( &self, py: Python<'py>, method: &str, args: impl IntoPy<Py<PyTuple>>, ) -> Result<Bound<'py, PyAny>, SourceError>
Calls method; a coroutine back is closed and refused, since a port
never drives an event loop.
Trait Implementations§
§impl CalendarSource for PySource
impl CalendarSource for PySource
§fn calendars(&self) -> Result<Vec<CalendarSpec>, SourceError>
fn calendars(&self) -> Result<Vec<CalendarSpec>, SourceError>
Every calendar the source holds. Read more
§impl MarketDataSource for PySource
impl MarketDataSource for PySource
§fn fetch(
&self,
demand: &Demand,
as_of: NaiveDate,
) -> Result<MarketData, SourceError>
fn fetch( &self, demand: &Demand, as_of: NaiveDate, ) -> Result<MarketData, SourceError>
What the source holds of
demand, observed on or before as_of.
Whatever it does not hold it leaves out. Read more§impl RecipeSource for PySource
impl RecipeSource for PySource
§fn recipes(&self, ask: &RecipeAsk) -> Result<Vec<RecipeSpec>, SourceError>
fn recipes(&self, ask: &RecipeAsk) -> Result<Vec<RecipeSpec>, SourceError>
The recipes the source holds for the keys
ask names. A recipe for a
key not asked about is accepted and used like any other. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PySource
impl Freeze for PySource
impl Send for PySource
impl Sync for PySource
impl Unpin for PySource
impl UnsafeUnpin for PySource
impl UnwindSafe for PySource
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