Skip to main content

PySource

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: String

Implementations§

§

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>

Calls method; a coroutine back is closed and refused, since a port never drives an event loop.

Trait Implementations§

§

impl CalendarSource for PySource

§

fn calendars(&self) -> Result<Vec<CalendarSpec>, SourceError>

Every calendar the source holds. Read more
§

impl MarketDataSource for PySource

§

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

§

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 more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,