pub struct PostSystemParams {
pub name: Option<String>,
/* private fields */
}Expand description
Parameters for the post_system endpoint.
Updating extended data variables requires donation status.
Fields§
§name: Option<String>A new name for the system. Limited to thirty characters.
Implementations§
Source§impl PostSystemParams
impl PostSystemParams
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new PostSystemParams.
Sourcepub fn new_rename(name: String) -> Self
pub fn new_rename(name: String) -> Self
Creates a new PostSystemParams with the provided name and no extended data variables.
Sourcepub fn add_update(
&mut self,
variable: ExtendedVariable,
update: ExtendedVariableUpdate,
) -> &mut Self
pub fn add_update( &mut self, variable: ExtendedVariable, update: ExtendedVariableUpdate, ) -> &mut Self
Adds a new extended variable update.
If there is already an update for this variable, it will be replaced with the provided update.
§Example
use pvoutput_client::types::params::{ExtendedVariable, ExtendedVariableUpdate, PostSystemParams};
let mut post = PostSystemParams::default();
let update = ExtendedVariableUpdate {
label: Some(String::from("Wind speed")),
unit: Some(String::from("m/s")),
..Default::default()
};
post.add_update(ExtendedVariable::V7, update);
assert_eq!(
post.get_update(ExtendedVariable::V7).map(|u| u.label.as_deref()).flatten(),
Some("Wind speed")
);
assert!(post.get_update(ExtendedVariable::V8).is_none());Sourcepub fn get_update(
&self,
variable: ExtendedVariable,
) -> Option<&ExtendedVariableUpdate>
pub fn get_update( &self, variable: ExtendedVariable, ) -> Option<&ExtendedVariableUpdate>
Gets the update for the given extended variable, if any.
Trait Implementations§
Source§impl Clone for PostSystemParams
impl Clone for PostSystemParams
Source§fn clone(&self) -> PostSystemParams
fn clone(&self) -> PostSystemParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PostSystemParams
impl Debug for PostSystemParams
Source§impl Default for PostSystemParams
impl Default for PostSystemParams
Source§fn default() -> PostSystemParams
fn default() -> PostSystemParams
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PostSystemParams
impl RefUnwindSafe for PostSystemParams
impl Send for PostSystemParams
impl Sync for PostSystemParams
impl Unpin for PostSystemParams
impl UnwindSafe for PostSystemParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more