Skip to content

Instantly share code, notes, and snippets.

@IslandUsurper
Created December 22, 2017 13:31
Show Gist options
  • Save IslandUsurper/a9e26a86225b3727189e59bb3af7ef0b to your computer and use it in GitHub Desktop.
Save IslandUsurper/a9e26a86225b3727189e59bb3af7ef0b to your computer and use it in GitHub Desktop.
Rust and XML schema
<ErrorRecovery>
<ListID>1235623425</ListID>
<EditSequence>whatever</EditSequence>
</ErrorRecovery>
<ErrorRecovery>
<OwnerID>FOO</OwnerID>
</ErrorRecovery>
<ErrorRecovery>
<TxnID>18302-1488303-random-numbers</TxnId>
<TxnNumber>9492023</TxnNumber>
</ErrorRecovery>
<xsd:element name="ErrorRecovery">
<xsd:complexType>
<xsd:sequence>
<xsd:choice>
<xsd:element ref="ListID" minOccurs="0"/>
<xsd:element ref="OwnerID" minOccurs="0"/>
<xsd:element ref="TxnID" minOccurs="0"/>
</xsd:choice>
<xsd:element ref="TxnNumber" minOccurs="0"/>
<xsd:element name="EditSequence" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="STRTYPE">
<xsd:maxLength value="16"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="ExternalGUID" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
#[derive(Debug, Deserialize)]
pub struct ErrorRecovery {
pub _id: Option<ErrorRecoveryID>,
pub txn_number: Option<i64>,
pub edit_sequence: Option<String>,
#[serde(rename = "ExternalGUID")]
pub external_guid: Option<String>,
}
#[derive(Debug, Deserialize)]
pub enum ErrorRecoveryId {
ListID(String),
OwnerID(String),
TxnID(String),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment