Skip to content

Commit

Permalink
Add From helper for MemberResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed Feb 25, 2022
1 parent 26d1ac0 commit 4950d53
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/tg4/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ pub struct MemberResponse {
pub start_height: Option<u64>,
}

impl From<Option<MemberInfo>> for MemberResponse {
fn from(mi: Option<MemberInfo>) -> Self {
match mi {
None => Self {
points: None,
start_height: None,
},
Some(mi) => Self {
points: Some(mi.points),
start_height: mi.start_height,
},
}
}
}

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct TotalPointsResponse {
pub points: u64,
Expand Down

0 comments on commit 4950d53

Please sign in to comment.