[−][src]Trait bigml::resource::Resource
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?