bee_ledger_types/
created_output.rs1use core::ops::Deref;
5
6use bee_block::{output::Output, payload::milestone::MilestoneIndex, protocol::ProtocolParameters, BlockId};
7
8use crate::error::Error;
9
10#[derive(Clone, Debug, Eq, PartialEq, packable::Packable)]
12#[packable(unpack_error = Error)]
13#[packable(unpack_visitor = ProtocolParameters)]
14pub struct CreatedOutput {
15 block_id: BlockId,
16 milestone_index: MilestoneIndex,
17 milestone_timestamp: u32,
18 inner: Output,
19}
20
21impl CreatedOutput {
22 pub fn new(block_id: BlockId, milestone_index: MilestoneIndex, milestone_timestamp: u32, inner: Output) -> Self {
24 Self {
25 block_id,
26 milestone_index,
27 milestone_timestamp,
28 inner,
29 }
30 }
31
32 pub fn block_id(&self) -> &BlockId {
34 &self.block_id
35 }
36
37 pub fn milestone_index(&self) -> MilestoneIndex {
39 self.milestone_index
40 }
41
42 pub fn milestone_timestamp(&self) -> u32 {
44 self.milestone_timestamp
45 }
46
47 pub fn inner(&self) -> &Output {
49 &self.inner
50 }
51}
52
53impl Deref for CreatedOutput {
54 type Target = Output;
55
56 fn deref(&self) -> &Self::Target {
57 &self.inner
58 }
59}