pub struct LoadConfig<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> { /* private fields */ }Expand description
A load configuration for a BvGraph/BvGraphSeq.
A basic configuration is returned by
BvGraph::with_basename/BvGraphSeq::with_basename. The configuration
can then be customized using the setter methods of this struct, chained in
builder style, and finalized by calling load.
§Defaults
The default configuration returned by with_basename uses:
- big endianness (
BE); - dynamic dispatch;
- memory mapping for both the graph and the offsets.
§Configuration Axes
§Access Mode
BvGraph::with_basenamereturns a configuration for random access, which requires the Elias–Fano offsets file (.ef). The resulting graph supports both random access and sequential iteration.BvGraphSeq::with_basenamereturns a configuration for sequential access, which only needs the graph file (.graph). The resulting graph supports only sequential iteration.
§Endianness
endianness: sets the endianness of the graph file. Useendianness::<BE>()for big-endian (the default and the Java convention) orendianness::<LE>()for little-endian.
§Code Dispatch
dispatch: chooses between:Dynamic(default): reads the codes from the properties file; slightly slower due to indirect dispatch, but works with any graph.Static: the codes are fixed at compile time via const generics, enabling more aggressive optimization. The defaults match the Java defaults (γ for outdegrees, unary for references, γ for blocks, γ for intervals, ζ₃ for residuals). If your graph uses non-default codes, you must specify them explicitly.
§Load Mode
Controls how the graph bitstream and the offsets are accessed.
mode: sets the load mode for both the graph and the offsets. You can also set them independently:graph_mode: sets the mode for the graph only;offsets_mode: sets the mode for the offsets only (random access only).
The available modes are:
Mmap(default): memory maps the file. This is the most memory-efficient mode, as the OS manages paging. It is the recommended mode for large graphs.LoadMem: reads the file into allocated memory.LoadMmap: reads the file into memory obtained viammap, rather than the standard allocator.File: reads the graph from a file stream. The offsets are fully deserialized in memory using ε-serde’sload_full. Note that the graph file must be padded correctly for this mode.
§Memory flags
When using Mmap or LoadMmap, you can set MemoryFlags to
request transparent huge pages, etc.:
flags: sets flags for both the graph and offsets.graph_flags: sets flags for the graph only.offsets_flags: sets flags for the offsets only (random access only).
§Examples
Load with all defaults (big-endian, dynamic dispatch, memory-mapped):
let graph = BvGraph::with_basename("BASENAME").load()?;Load a little-endian graph:
let graph = BvGraph::with_basename("BASENAME")
.endianness::<LE>()
.load()?;Load with static dispatch (using default codes):
let graph = BvGraph::with_basename("BASENAME")
.dispatch::<Static>()
.load()?;Load into memory rather than memory-mapping:
let graph = BvGraph::with_basename("BASENAME")
.mode::<LoadMem>()
.load()?;Load a sequential-access graph (no .ef file needed):
let graph = BvGraphSeq::with_basename("BASENAME").load()?;Combine options:
let graph = BvGraph::with_basename("BASENAME")
.endianness::<LE>()
.dispatch::<Static>()
.mode::<LoadMem>()
.load()?;Implementations§
Source§impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
Sourcepub fn endianness<E2: Endianness>(self) -> LoadConfig<E2, A, D, GLM, OLM>
pub fn endianness<E2: Endianness>(self) -> LoadConfig<E2, A, D, GLM, OLM>
Set the endianness of the graph and offsets file.
Source§impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
Source§impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
Sourcepub fn mode<LM: LoadMode>(self) -> LoadConfig<E, A, D, LM, LM>
pub fn mode<LM: LoadMode>(self) -> LoadConfig<E, A, D, LM, LM>
Choose the LoadMode for the graph and offsets.
Source§impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, Mmap, Mmap>
impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, Mmap, Mmap>
Sourcepub fn flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, Mmap>
pub fn flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, Mmap>
Set flags for memory-mapping (both graph and offsets).
Source§impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, LoadMmap, LoadMmap>
impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, LoadMmap, LoadMmap>
Sourcepub fn flags(
self,
flags: MemoryFlags,
) -> LoadConfig<E, A, D, LoadMmap, LoadMmap>
pub fn flags( self, flags: MemoryFlags, ) -> LoadConfig<E, A, D, LoadMmap, LoadMmap>
Set flags for memory obtained from mmap() (both graph and offsets).
Source§impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>
Sourcepub fn graph_mode<NGLM: LoadMode>(self) -> LoadConfig<E, A, D, NGLM, OLM>
pub fn graph_mode<NGLM: LoadMode>(self) -> LoadConfig<E, A, D, NGLM, OLM>
Choose the LoadMode for the graph only.
Source§impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, Mmap, OLM>
impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, Mmap, OLM>
Sourcepub fn graph_flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, OLM>
pub fn graph_flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, OLM>
Set flags for memory-mapping the graph.
Source§impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, LoadMmap, OLM>
impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, LoadMmap, OLM>
Sourcepub fn graph_flags(
self,
flags: MemoryFlags,
) -> LoadConfig<E, A, D, LoadMmap, OLM>
pub fn graph_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, A, D, LoadMmap, OLM>
Set flags for memory obtained from mmap() for the graph.
Source§impl<E: Endianness, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, D, GLM, OLM>
impl<E: Endianness, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, D, GLM, OLM>
Sourcepub fn offsets_mode<NOLM: LoadMode>(self) -> LoadConfig<E, Random, D, GLM, NOLM>
pub fn offsets_mode<NOLM: LoadMode>(self) -> LoadConfig<E, Random, D, GLM, NOLM>
Choose the LoadMode for the offsets only.
Source§impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, Mmap>
impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, Mmap>
Sourcepub fn offsets_flags(
self,
flags: MemoryFlags,
) -> LoadConfig<E, Random, D, GLM, Mmap>
pub fn offsets_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, Random, D, GLM, Mmap>
Set flags for memory-mapping the offsets.
Source§impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, LoadMmap>
impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, LoadMmap>
Sourcepub fn offsets_flags(
self,
flags: MemoryFlags,
) -> LoadConfig<E, Random, D, GLM, LoadMmap>
pub fn offsets_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, Random, D, GLM, LoadMmap>
Set flags for memory obtained from mmap() for the graph.
Source§impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, Dynamic, GLM, OLM>
impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, Dynamic, GLM, OLM>
Sourcepub fn load(
self,
) -> Result<BvGraph<DynCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,
pub fn load(
self,
) -> Result<BvGraph<DynCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,
Load a random-access graph with dynamic dispatch.
Source§impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Sequential, Dynamic, GLM, OLM>
impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Sequential, Dynamic, GLM, OLM>
Sourcepub fn load(
self,
) -> Result<BvGraphSeq<DynCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,
pub fn load(
self,
) -> Result<BvGraphSeq<DynCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,
Load a sequential graph with dynamic dispatch.
Source§impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Random, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>
impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Random, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>
Sourcepub fn load(
self,
) -> Result<BvGraph<ConstCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,
pub fn load(
self,
) -> Result<BvGraph<ConstCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,
Load a random-access graph with static dispatch.
Source§impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Sequential, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>
impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Sequential, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>
Sourcepub fn load(
self,
) -> Result<BvGraphSeq<ConstCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,
pub fn load(
self,
) -> Result<BvGraphSeq<ConstCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>where
<GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>,
for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,
Load a sequential graph with static dispatch.
Trait Implementations§
Source§impl<E: Clone + Endianness, A: Clone + Access, D: Clone + Dispatch, GLM: Clone + LoadMode, OLM: Clone + LoadMode> Clone for LoadConfig<E, A, D, GLM, OLM>
impl<E: Clone + Endianness, A: Clone + Access, D: Clone + Dispatch, GLM: Clone + LoadMode, OLM: Clone + LoadMode> Clone for LoadConfig<E, A, D, GLM, OLM>
Source§fn clone(&self) -> LoadConfig<E, A, D, GLM, OLM>
fn clone(&self) -> LoadConfig<E, A, D, GLM, OLM>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<E, A, D, GLM, OLM> Freeze for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> RefUnwindSafe for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> Send for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> Sync for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> Unpin for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> UnsafeUnpin for LoadConfig<E, A, D, GLM, OLM>
impl<E, A, D, GLM, OLM> UnwindSafe for LoadConfig<E, A, D, GLM, OLM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more