Skip to content

Commit

Permalink
Now using DeserType alias
Browse files Browse the repository at this point in the history
  • Loading branch information
vigna committed Feb 7, 2024
1 parent 5e052bc commit 7e6db01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions src/graphs/bvgraph/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -124,7 +125,7 @@ pub struct Mmap {}
#[sealed]
impl LoadMode for Mmap {
type Factory<E: Endianness> = MmapBackend<u32>;
type Offsets = <EF as DeserializeInner>::DeserType<'static>;
type Offsets = DeserType<'static, EF>;

fn new_factory<E: Endianness>(graph: &PathBuf, flags: MemoryFlags) -> Result<Self::Factory<E>> {
MmapBackend::load(graph, flags.into())
Expand All @@ -141,7 +142,7 @@ pub struct LoadMem {}
#[sealed]
impl LoadMode for LoadMem {
type Factory<E: Endianness> = MemoryFactory<E, Box<[u32]>>;
type Offsets = <EF as DeserializeInner>::DeserType<'static>;
type Offsets = DeserType<'static, EF>;

fn new_factory<E: Endianness>(
graph: &PathBuf,
Expand All @@ -163,7 +164,7 @@ pub struct LoadMmap {}
#[sealed]
impl LoadMode for LoadMmap {
type Factory<E: Endianness> = MemoryFactory<E, MmapBackend<u32>>;
type Offsets = <EF as DeserializeInner>::DeserType<'static>;
type Offsets = DeserType<'static, EF>;

fn new_factory<E: Endianness>(graph: &PathBuf, flags: MemoryFlags) -> Result<Self::Factory<E>> {
MemoryFactory::<E, _>::new_mmap(graph, flags)
Expand Down
12 changes: 4 additions & 8 deletions src/labels/swh_labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,7 +55,7 @@ pub struct SwhLabels<RB: ReaderBuilder, O: IndexedDict> {
offsets: MemCase<O>,
}

impl SwhLabels<MmapReaderBuilder, <EF as DeserializeInner>::DeserType<'static>> {
impl SwhLabels<MmapReaderBuilder, DeserType<'static, EF>> {
pub fn load_from_file(width: usize, path: impl AsRef<Path>) -> Result<Self> {
let path = path.as_ref();
let backend_path = path.with_extension("labels");
Expand Down Expand Up @@ -149,9 +149,7 @@ impl<'a, BR: BitRead<BE> + BitSeek + GammaRead<BE>> std::iter::Iterator for SeqL
}
}

impl SequentialLabeling
for SwhLabels<MmapReaderBuilder, <EF as DeserializeInner>::DeserType<'static>>
{
impl SequentialLabeling for SwhLabels<MmapReaderBuilder, DeserType<'static, EF>> {
type Label = Vec<u64>;

type Iterator<'node> = Iterator<'node, <MmapReaderBuilder as ReaderBuilder>::Reader<'node>, <EF as DeserializeInner>::DeserType<'node>>
Expand Down Expand Up @@ -195,9 +193,7 @@ impl<BR: BitRead<BE> + BitSeek + GammaRead<BE>> std::iter::Iterator for RanLabel
}
}

impl RandomAccessLabeling
for SwhLabels<MmapReaderBuilder, <EF as DeserializeInner>::DeserType<'static>>
{
impl RandomAccessLabeling for SwhLabels<MmapReaderBuilder, DeserType<'static, EF>> {
type Labels<'succ> = RanLabels<<MmapReaderBuilder as ReaderBuilder>::Reader<'succ>> where Self: 'succ;

fn num_arcs(&self) -> u64 {
Expand Down

0 comments on commit 7e6db01

Please sign in to comment.