Skip to content

Commit

Permalink
chore: add number to tag
Browse files Browse the repository at this point in the history
  • Loading branch information
fekie committed Jun 6, 2023
1 parent 8c3c4ea commit 0e76205
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/trade_ads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ pub enum RequestTag {
Adds,
}

impl TryFrom<u8> for RequestTag {
type Error = RoliError;

fn try_from(value: u8) -> Result<Self, Self::Error> {
match value {
1 => Ok(Self::Demand),
2 => Ok(Self::Rares),
3 => Ok(Self::Robux),
4 => Ok(Self::Any),
5 => Ok(Self::Upgrade),
6 => Ok(Self::Downgrade),
7 => Ok(Self::Rap),
8 => Ok(Self::Wishlist),
9 => Ok(Self::Projecteds),
10 => Ok(Self::Adds),
_ => Err(RoliError::MalformedResponse),
}
}
}

/// Used to specify details of the trade one wants to post.
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
pub struct CreateTradeAdParams {
Expand Down

0 comments on commit 0e76205

Please sign in to comment.