Trait ResourceCollectionContext

Source
pub trait ResourceCollectionContext {
    // Required methods
    fn add_collection_context(
        &self,
    ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>;
    fn replace_add_collection_context(
        &mut self,
        add_context: PythonResourceAddCollectionContext,
    ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>;
    fn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>;

    // Provided methods
    fn add_collection_context_attrs(&self) -> Vec<&'static str> { ... }
    fn get_attr_add_collection_context(&self, attribute: &str) -> ValueResult { ... }
    fn set_attr_add_collection_context(
        &mut self,
        attribute: &str,
        value: Value,
    ) -> Result<(), ValueError> { ... }
}
Expand description

Defines functionality for exposing PythonResourceAddCollectionContext from a type.

Required Methods§

Source

fn add_collection_context( &self, ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>

Obtain the PythonResourceAddCollectionContext associated with this instance, if available.

Source

fn replace_add_collection_context( &mut self, add_context: PythonResourceAddCollectionContext, ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>

Set the PythonResourceAddCollectionContext value on this instance.

Returns the old value.

Source

fn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>

Cast this instance to a PythonResource.

Provided Methods§

Source

fn add_collection_context_attrs(&self) -> Vec<&'static str>

Obtains the Starlark object attributes that are defined by the add collection context.

Source

fn get_attr_add_collection_context(&self, attribute: &str) -> ValueResult

Obtain the attribute value for an add collection context.

The caller should verify the attribute should be serviced by us before calling.

Source

fn set_attr_add_collection_context( &mut self, attribute: &str, value: Value, ) -> Result<(), ValueError>

Implementors§