Minor fixes.
parent
7db07e742a
commit
7300ac7b84
|
@ -53,7 +53,7 @@ pub struct SetResponse<O: SetObject> {
|
||||||
old_state: Option<String>,
|
old_state: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "newState")]
|
#[serde(rename = "newState")]
|
||||||
new_state: Option<String>,
|
new_state: String,
|
||||||
|
|
||||||
#[serde(rename = "created")]
|
#[serde(rename = "created")]
|
||||||
created: Option<HashMap<String, O>>,
|
created: Option<HashMap<String, O>>,
|
||||||
|
@ -230,12 +230,12 @@ impl<O: SetObject> SetResponse<O> {
|
||||||
self.old_state.as_deref()
|
self.old_state.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_state(&self) -> Option<&str> {
|
pub fn new_state(&self) -> &str {
|
||||||
self.new_state.as_deref()
|
self.new_state.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn take_new_state(&mut self) -> Option<String> {
|
pub fn take_new_state(&mut self) -> String {
|
||||||
self.new_state.take()
|
std::mem::take(&mut self.new_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn created(&mut self, id: &str) -> crate::Result<O> {
|
pub fn created(&mut self, id: &str) -> crate::Result<O> {
|
||||||
|
|
|
@ -159,6 +159,10 @@ impl EmailImportResponse {
|
||||||
&self.new_state
|
&self.new_state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_new_state(&mut self) -> String {
|
||||||
|
std::mem::take(&mut self.new_state)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn created(&mut self, id: &str) -> crate::Result<Email> {
|
pub fn created(&mut self, id: &str) -> crate::Result<Email> {
|
||||||
if let Some(result) = self.created.as_mut().and_then(|r| r.remove(id)) {
|
if let Some(result) = self.created.as_mut().and_then(|r| r.remove(id)) {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|
Loading…
Reference in New Issue