pub struct ProofResult {
pub index: usize,
pub accepted: bool,
pub proof_id: Option<Uuid>,
pub reward_points: Option<Points>,
pub rejection_reason: Option<String>,
}Expand description
Result for an individual proof in a batch.
Fields§
§index: usizeIndex in the original batch.
accepted: boolWhether the proof was accepted.
proof_id: Option<Uuid>Proof ID if accepted.
reward_points: Option<Points>Reward points if accepted.
rejection_reason: Option<String>Rejection reason if not accepted.
Implementations§
Source§impl ProofResult
impl ProofResult
Sourcepub fn accepted(index: usize, proof_id: Uuid, reward_points: Points) -> Self
pub fn accepted(index: usize, proof_id: Uuid, reward_points: Points) -> Self
Create a result for an accepted proof.
§Example
use chie_shared::types::batch::ProofResult;
use uuid::Uuid;
let proof_id = Uuid::new_v4();
let result = ProofResult::accepted(0, proof_id, 1000);
assert!(result.accepted);
assert_eq!(result.index, 0);
assert_eq!(result.proof_id, Some(proof_id));
assert_eq!(result.reward_points, Some(1000));
assert_eq!(result.rejection_reason, None);Sourcepub fn rejected(index: usize, reason: impl Into<String>) -> Self
pub fn rejected(index: usize, reason: impl Into<String>) -> Self
Create a result for a rejected proof.
§Example
use chie_shared::types::batch::ProofResult;
let result = ProofResult::rejected(2, "Invalid signature length");
assert!(!result.accepted);
assert_eq!(result.index, 2);
assert_eq!(result.proof_id, None);
assert_eq!(result.reward_points, None);
assert_eq!(result.rejection_reason, Some("Invalid signature length".to_string()));Trait Implementations§
Source§impl Clone for ProofResult
impl Clone for ProofResult
Source§fn clone(&self) -> ProofResult
fn clone(&self) -> ProofResult
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 ProofResult
impl Debug for ProofResult
Source§impl<'de> Deserialize<'de> for ProofResult
impl<'de> Deserialize<'de> for ProofResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProofResult
impl RefUnwindSafe for ProofResult
impl Send for ProofResult
impl Sync for ProofResult
impl Unpin for ProofResult
impl UnwindSafe for ProofResult
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