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§
Implementations on Foreign Types§
source§impl<T: Updatable, H: BuildHasher> Updatable for HashMap<String, T, H>
impl<T: Updatable, H: BuildHasher> Updatable for HashMap<String, T, H>
HashMap<String, T>
can be updated using HashMap<String, T::Update>
.