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§
Sourcefn add_collection_context(
&self,
) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
fn add_collection_context( &self, ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
Obtain the PythonResourceAddCollectionContext
associated with this instance, if available.
Sourcefn replace_add_collection_context(
&mut self,
add_context: PythonResourceAddCollectionContext,
) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
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.
Sourcefn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>
fn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>
Cast this instance to a PythonResource
.
Provided Methods§
Sourcefn add_collection_context_attrs(&self) -> Vec<&'static str>
fn add_collection_context_attrs(&self) -> Vec<&'static str>
Obtains the Starlark object attributes that are defined by the add collection context.
Sourcefn get_attr_add_collection_context(&self, attribute: &str) -> ValueResult
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.