From 7e6db01e5155c7168725a0822bfcb1f52bab4f4d Mon Sep 17 00:00:00 2001 From: Sebastiano Vigna Date: Wed, 7 Feb 2024 16:25:15 +0100 Subject: [PATCH] Now using DeserType alias --- Cargo.toml | 4 ++-- src/graphs/bvgraph/load.rs | 7 ++++--- src/labels/swh_labels.rs | 12 ++++-------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0bcc6e1b..cb9fa3f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,8 +23,8 @@ java-properties = "2.0.0" mmap-rs = "0.6.1" bitvec = { version = "1.0.1", features = ["atomic"] } num_cpus = "1.16.0" -epserde = "0.3.1" -sux = "0.1.3" +epserde = "0.4.0" +sux = "0.2.0" dsi-bitstream = "0.2.2" clap = { version = "4.4.18", features = ["derive"] } dsi-progress-logger = "0.2.2" diff --git a/src/graphs/bvgraph/load.rs b/src/graphs/bvgraph/load.rs index 3b628d74..25569c1a 100644 --- a/src/graphs/bvgraph/load.rs +++ b/src/graphs/bvgraph/load.rs @@ -11,6 +11,7 @@ use crate::graphs::bvgraph::EmptyDict; use crate::prelude::*; use anyhow::{Context, Result}; use dsi_bitstream::prelude::*; +use epserde::deser::DeserType; use epserde::prelude::*; use java_properties; use sealed::sealed; @@ -124,7 +125,7 @@ pub struct Mmap {} #[sealed] impl LoadMode for Mmap { type Factory = MmapBackend; - type Offsets = ::DeserType<'static>; + type Offsets = DeserType<'static, EF>; fn new_factory(graph: &PathBuf, flags: MemoryFlags) -> Result> { MmapBackend::load(graph, flags.into()) @@ -141,7 +142,7 @@ pub struct LoadMem {} #[sealed] impl LoadMode for LoadMem { type Factory = MemoryFactory>; - type Offsets = ::DeserType<'static>; + type Offsets = DeserType<'static, EF>; fn new_factory( graph: &PathBuf, @@ -163,7 +164,7 @@ pub struct LoadMmap {} #[sealed] impl LoadMode for LoadMmap { type Factory = MemoryFactory>; - type Offsets = ::DeserType<'static>; + type Offsets = DeserType<'static, EF>; fn new_factory(graph: &PathBuf, flags: MemoryFlags) -> Result> { MemoryFactory::::new_mmap(graph, flags) diff --git a/src/labels/swh_labels.rs b/src/labels/swh_labels.rs index 4ec26efb..6779c6f2 100644 --- a/src/labels/swh_labels.rs +++ b/src/labels/swh_labels.rs @@ -17,7 +17,7 @@ use dsi_bitstream::{ impls::{BufBitReader, MemWordReader}, traits::{BitRead, BitSeek, BE}, }; -use epserde::prelude::*; +use epserde::{deser::DeserType, prelude::*}; use lender::{Lend, Lender, Lending}; use mmap_rs::MmapFlags; use std::path::Path; @@ -55,7 +55,7 @@ pub struct SwhLabels { offsets: MemCase, } -impl SwhLabels::DeserType<'static>> { +impl SwhLabels> { pub fn load_from_file(width: usize, path: impl AsRef) -> Result { let path = path.as_ref(); let backend_path = path.with_extension("labels"); @@ -149,9 +149,7 @@ impl<'a, BR: BitRead + BitSeek + GammaRead> std::iter::Iterator for SeqL } } -impl SequentialLabeling - for SwhLabels::DeserType<'static>> -{ +impl SequentialLabeling for SwhLabels> { type Label = Vec; type Iterator<'node> = Iterator<'node, ::Reader<'node>, ::DeserType<'node>> @@ -195,9 +193,7 @@ impl + BitSeek + GammaRead> std::iter::Iterator for RanLabel } } -impl RandomAccessLabeling - for SwhLabels::DeserType<'static>> -{ +impl RandomAccessLabeling for SwhLabels> { type Labels<'succ> = RanLabels<::Reader<'succ>> where Self: 'succ; fn num_arcs(&self) -> u64 {