Trait bigml::resource::Updatable

source ·
pub trait Updatable {
    type Update: Serialize + Debug;
}
Expand description

A value which can be updated using the BigML API. May be a Resource or a piece of data contained in Resource. This is normally passed to Client::update.

Instances of the generated Updatable::Update type are normally created using struct initialization expressions including .. and a default value:

use bigml::resource::source::{FieldUpdate, Optype};

// Change the inferred optype of a field.
let field_update = FieldUpdate {
    optype: Some(Optype::Categorical),
    ..FieldUpdate::default()
};

Implementing Updatable (internal only)

For primitive types like String or bool, you should add them to the primitive_updatable_types! macro, which will define type Update = self. You can also do this manually for simple enum types, and other values which can only be updated as a whole.

For struct types, you should use #[derive(Updatable)] and mark updatable fields with #[updatable]. For a struct Foo, this will generate a corresponding FooUpdate type, containing only those fields marked as #[updatable] (with appropriate types).

Required Associated Types§

source

type Update: Serialize + Debug

The type of the data used to update this value.

Implementations on Foreign Types§

source§

impl Updatable for i64

§

type Update = i64

source§

impl Updatable for String

source§

impl<T: Updatable> Updatable for Vec<T>

Vec<T> can be updated using Vec<T::Update>.

source§

impl<T: Updatable> Updatable for Option<T>

Option<T> can be updated using Option<T::Update>.

source§

impl<T: Updatable, H: BuildHasher> Updatable for HashMap<String, T, H>

HashMap<String, T> can be updated using HashMap<String, T::Update>.

source§

impl Updatable for bool

§

type Update = bool

source§

impl Updatable for u16

§

type Update = u16

Implementors§