rectangle_device_blocks/package.rs
1use crate::core::{Block, Cid, PbLink};
2
3pub trait Package {
4 type BlockIterator: Iterator<Item=Block>;
5
6 fn cid(&self) -> &Cid;
7 fn total_size(&self) -> u64;
8 fn into_blocks(self) -> Self::BlockIterator;
9
10 fn link(&self, name: String) -> PbLink {
11 PbLink {
12 cid: self.cid().clone(),
13 size: self.total_size(),
14 name
15 }
16 }
17}