Skip to content

Commit 85cefec

Browse files
committed
remove second generic argument for FileFile
1 parent a7dc992 commit 85cefec

File tree

5 files changed

+46
-45
lines changed

5 files changed

+46
-45
lines changed

cli/src/dump.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ where
5454
fs::create_dir_all(dst)?;
5555

5656
print!("Reading contract stockpile from '{}' ... ", src.display());
57-
let mut stockpile = Stockpile::<FileSupply, FilePile<SealDef, SealDef::Src>>::load(src);
57+
let mut stockpile = Stockpile::<FileSupply, FilePile<SealDef>>::load(src);
5858
println!("success reading {}", stockpile.contract_id());
5959

6060
print!("Processing contract articles ... ");

src/mound.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ pub mod file {
320320
}
321321
}
322322

323-
impl<SealDef: RgbSealDef> Excavate<FileSupply, FilePile<SealDef, SealDef::Src>>
324-
for DirExcavator<SealDef>
323+
impl<SealDef: RgbSealDef> Excavate<FileSupply, FilePile<SealDef>> for DirExcavator<SealDef>
325324
where
326325
<SealDef::Src as SingleUseSeal>::CliWitness: StrictEncode + StrictDecode,
327326
<SealDef::Src as SingleUseSeal>::PubWitness: StrictEncode + StrictDecode,
@@ -342,8 +341,7 @@ pub mod file {
342341

343342
fn contracts(
344343
&mut self,
345-
) -> impl Iterator<Item = (ContractId, Stockpile<FileSupply, FilePile<SealDef, SealDef::Src>>)>
346-
{
344+
) -> impl Iterator<Item = (ContractId, Stockpile<FileSupply, FilePile<SealDef>>)> {
347345
self.contents(false).filter_map(|(ty, path)| {
348346
if ty.is_dir() && path.extension().and_then(OsStr::to_str) == Some("contract") {
349347
let contract = Stockpile::load(path);
@@ -357,8 +355,7 @@ pub mod file {
357355
}
358356
}
359357

360-
pub type DirMound<SealDef> =
361-
Mound<FileSupply, FilePile<SealDef, <SealDef as RgbSealDef>::Src>, DirExcavator<SealDef>>;
358+
pub type DirMound<SealDef> = Mound<FileSupply, FilePile<SealDef>, DirExcavator<SealDef>>;
362359

363360
impl<SealDef: RgbSealDef> DirMound<SealDef>
364361
where
@@ -379,7 +376,7 @@ pub mod file {
379376
) -> Result<ContractId, IssueError> {
380377
let dir = self.persistence.consensus_dir();
381378
let supply = FileSupply::new(params.name.as_str(), &dir);
382-
let pile = FilePile::<SealDef, SealDef::Src>::new(params.name.as_str(), &dir);
379+
let pile = FilePile::<SealDef>::new(params.name.as_str(), &dir);
383380
self.issue(params, supply, pile)
384381
}
385382

src/pile.rs

+29-24
Original file line numberDiff line numberDiff line change
@@ -175,26 +175,27 @@ pub mod fs {
175175
}
176176
}
177177

178-
pub struct FilePile<SealDef: RgbSealDef<Src = SealSrc>, SealSrc: RgbSealSrc>
179-
where <SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId:
178+
pub struct FilePile<SealDef: RgbSealDef>
179+
where <<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
180180
Copy + Ord + From<[u8; 32]> + Into<[u8; 32]>
181181
{
182182
hoard: FileAora<
183-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId,
184-
SealSrc::CliWitness,
183+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
184+
<SealDef::Src as SingleUseSeal>::CliWitness,
185185
>,
186186
cache: FileAora<
187-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId,
188-
SealSrc::PubWitness,
187+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
188+
<SealDef::Src as SingleUseSeal>::PubWitness,
189189
>,
190190
keep: FileAora<Opid, SmallOrdMap<u16, SealDef>>,
191-
index:
192-
FileIndex<<<SealSrc as SingleUseSeal>::PubWitness as PublishedWitness<SealSrc>>::PubId>,
191+
index: FileIndex<
192+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
193+
>,
193194
_phantom: PhantomData<SealDef>,
194195
}
195196

196-
impl<SealDef: RgbSealDef<Src = SealSrc>, SealSrc: RgbSealSrc> FilePile<SealDef, SealSrc>
197-
where <SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId:
197+
impl<SealDef: RgbSealDef> FilePile<SealDef>
198+
where <<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
198199
Copy + Ord + From<[u8; 32]> + Into<[u8; 32]>
199200
{
200201
pub fn new(name: &str, path: impl AsRef<Path>) -> Self {
@@ -212,8 +213,8 @@ pub mod fs {
212213
}
213214
}
214215

215-
impl<SealDef: RgbSealDef<Src = SealSrc>, SealSrc: RgbSealSrc> FilePile<SealDef, SealSrc>
216-
where <SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId:
216+
impl<SealDef: RgbSealDef> FilePile<SealDef>
217+
where <<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
217218
Copy + Ord + From<[u8; 32]> + Into<[u8; 32]>
218219
{
219220
pub fn open(path: impl AsRef<Path>) -> Self {
@@ -230,26 +231,27 @@ pub mod fs {
230231
}
231232
}
232233

233-
impl<SealDef: RgbSealDef<Src = SealSrc>, SealSrc: RgbSealSrc> Pile for FilePile<SealDef, SealSrc>
234+
impl<SealDef: RgbSealDef> Pile for FilePile<SealDef>
234235
where
235-
SealSrc::CliWitness: StrictEncode + StrictDecode,
236-
SealSrc::PubWitness: StrictEncode + StrictDecode,
237-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId:
236+
<SealDef::Src as SingleUseSeal>::CliWitness: StrictEncode + StrictDecode,
237+
<SealDef::Src as SingleUseSeal>::PubWitness: StrictEncode + StrictDecode,
238+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
238239
Copy + Ord + From<[u8; 32]> + Into<[u8; 32]>,
239240
{
240-
type SealSrc = SealSrc;
241241
type SealDef = SealDef;
242+
type SealSrc = SealDef::Src;
242243
type Hoard = FileAora<
243-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId,
244-
SealSrc::CliWitness,
244+
<<Self::SealSrc as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
245+
<Self::SealSrc as SingleUseSeal>::CliWitness,
245246
>;
246247
type Cache = FileAora<
247-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId,
248-
SealSrc::PubWitness,
248+
<<Self::SealSrc as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
249+
<Self::SealSrc as SingleUseSeal>::PubWitness,
249250
>;
250251
type Keep = FileAora<Opid, SmallOrdMap<u16, SealDef>>;
251-
type Index =
252-
FileIndex<<<SealSrc as SingleUseSeal>::PubWitness as PublishedWitness<SealSrc>>::PubId>;
252+
type Index = FileIndex<
253+
<<Self::SealSrc as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId,
254+
>;
253255

254256
fn hoard(&self) -> &Self::Hoard { &self.hoard }
255257

@@ -267,7 +269,10 @@ pub mod fs {
267269

268270
fn index_mut(&mut self) -> &mut Self::Index { &mut self.index }
269271

270-
fn retrieve(&mut self, opid: Opid) -> impl ExactSizeIterator<Item = SealWitness<SealSrc>> {
272+
fn retrieve(
273+
&mut self,
274+
opid: Opid,
275+
) -> impl ExactSizeIterator<Item = SealWitness<SealDef::Src>> {
271276
self.index.get(opid).map(|pubid| {
272277
let client = self.hoard.read(pubid);
273278
let published = self.cache.read(pubid);

src/popls/bp.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ pub mod file {
867867
use crate::mound::file::DirExcavator;
868868
use crate::FilePile;
869869

870-
pub type DirBarrow<W> =
871-
Barrow<W, FileSupply, FilePile<WTxoSeal, TxoSeal>, DirExcavator<WTxoSeal>>;
870+
pub type DirBarrow<W> = Barrow<W, FileSupply, FilePile<WTxoSeal>, DirExcavator<WTxoSeal>>;
872871

873872
impl<W: WalletProvider> DirBarrow<W> {
874873
pub fn issue_to_file(
@@ -889,5 +888,5 @@ pub mod file {
889888
}
890889
}
891890

892-
pub type BpDirMound = Mound<FileSupply, FilePile<WTxoSeal, TxoSeal>, DirExcavator<WTxoSeal>>;
891+
pub type BpDirMound = Mound<FileSupply, FilePile<WTxoSeal>, DirExcavator<WTxoSeal>>;
893892
}

src/stockpile.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ use hypersonic::{
4040
Schema, StateAtom, StateName, Stock, Supply,
4141
};
4242
use rgb::{
43-
ContractApi, ContractVerify, OperationSeals, ReadOperation, ReadWitness, RgbSealDef,
44-
RgbSealSrc, Step, VerificationError,
43+
ContractApi, ContractVerify, OperationSeals, ReadOperation, ReadWitness, RgbSealDef, Step,
44+
VerificationError,
4545
};
4646
use single_use_seals::{PublishedWitness, SealWitness, SingleUseSeal};
4747
use strict_encoding::{
@@ -464,12 +464,11 @@ mod fs {
464464
use super::*;
465465
use crate::FilePile;
466466

467-
impl<SealDef: RgbSealDef<Src = SealSrc>, SealSrc: RgbSealSrc>
468-
Stockpile<FileSupply, FilePile<SealDef, SealSrc>>
467+
impl<SealDef: RgbSealDef> Stockpile<FileSupply, FilePile<SealDef>>
469468
where
470-
SealSrc::CliWitness: StrictEncode + StrictDecode,
471-
SealSrc::PubWitness: StrictEncode + StrictDecode,
472-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId:
469+
<SealDef::Src as SingleUseSeal>::CliWitness: StrictEncode + StrictDecode,
470+
<SealDef::Src as SingleUseSeal>::PubWitness: StrictEncode + StrictDecode,
471+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
473472
Ord + From<[u8; 32]> + Into<[u8; 32]>,
474473
{
475474
pub fn load(path: impl AsRef<Path>) -> Self {
@@ -496,9 +495,10 @@ mod fs {
496495
path: impl AsRef<Path>,
497496
) -> io::Result<()>
498497
where
499-
SealSrc::CliWitness: StrictDumb,
500-
SealSrc::PubWitness: StrictDumb,
501-
<SealSrc::PubWitness as PublishedWitness<SealSrc>>::PubId: StrictEncode,
498+
<SealDef::Src as SingleUseSeal>::CliWitness: StrictDumb,
499+
<SealDef::Src as SingleUseSeal>::PubWitness: StrictDumb,
500+
<<SealDef::Src as SingleUseSeal>::PubWitness as PublishedWitness<SealDef::Src>>::PubId:
501+
StrictEncode,
502502
{
503503
let file = File::create_new(path)?;
504504
let writer = StrictWriter::with(StreamWriter::new::<{ usize::MAX }>(file));

0 commit comments

Comments
 (0)