[][src]Trait bigml::resource::Resource

pub trait Resource: Debug + DeserializeOwned + Send + Serialize + Sync + 'static {
    fn id_prefix() -> &'static str;
fn create_path() -> &'static str;
fn common(&self) -> &ResourceCommon;
fn id(&self) -> &Id<Self>;
fn status(&self) -> &dyn Status; }

A shared interface to all BigML resource types.

Implementing Resource (internal only)

Normally you want to implement this using #[derive(Resource)], which will look something like:

#[derive(Clone, Debug, Deserialize, Resource, Serialize, Updatable)]
#[api_name = "exampleresource"]
pub struct ExampleResource {
    /// Common resource information. These fields will be serialized at the
    /// top-level of this structure by `serde`.
    #[serde(flatten)]
    #[updatable(flatten)]
    pub common: ResourceCommon,

    /// The ID of this resource.
    pub resource: Id<ExampleResource>,

    /// The status of this resource. (Must be a type which implements
    /// `Status`, normally `GenericStatus` for most resources, except those
    /// with extended status data.)
    pub status: GenericStatus,

    // Resource-specific fields here.

    /// Placeholder to allow extensibility without breaking the API.
    #[serde(skip)]
    _placeholder: (),
}

Required methods

fn id_prefix() -> &'static str

The prefix used for all IDs of this type.

fn create_path() -> &'static str

The URL path used to create a new resource of this type.

fn common(&self) -> &ResourceCommon

Fields shared between all resource types. These are "flattened" into the top-level of the JSON version of this resource.

fn id(&self) -> &Id<Self>

The ID of this resource.

fn status(&self) -> &dyn Status

The status code for this resource.

TODO: Does this need to go in a separate trait in order to maintain trait object support?

Loading content...

Implementors

impl Resource for BatchCentroid[src]

impl Resource for BatchPrediction[src]

impl Resource for Cluster[src]

impl Resource for Dataset[src]

impl Resource for Ensemble[src]

impl Resource for Execution[src]

impl Resource for Library[src]

impl Resource for Script[src]

impl Resource for Source[src]

impl<R: Result> Resource for Evaluation<R>[src]

Loading content...