pub struct SwhGraphProperties<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> { /* private fields */ }
Expand description
Properties on graph nodes
This structures has many type parameters, to allow loading only some properties, and checking at compile time that only loaded properties are accessed.
Extra properties can be loaded, following the builder pattern on the owning graph. For example, this does not compile:
use swh_graph::graph::SwhGraphWithProperties;
use swh_graph::mph::DynMphf;
use swh_graph::SwhGraphProperties;
swh_graph::graph::SwhUnidirectionalGraph::new(PathBuf::from("./graph"))
.expect("Could not load graph")
.init_properties()
.properties()
.author_timestamp(42);
but this does:
use swh_graph::graph::SwhGraphWithProperties;
use swh_graph::mph::DynMphf;
use swh_graph::SwhGraphProperties;
swh_graph::graph::SwhUnidirectionalGraph::new(PathBuf::from("./graph"))
.expect("Could not load graph")
.init_properties()
.load_properties(SwhGraphProperties::load_timestamps)
.expect("Could not load timestamp properties")
.properties()
.author_timestamp(42);
Implementations§
Source§impl<TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<NoMaps, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<NoMaps, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Sourcepub fn load_maps<MPHF: LoadableSwhidMphf>(
self,
) -> Result<SwhGraphProperties<MappedMaps<MPHF>, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn load_maps<MPHF: LoadableSwhidMphf>( self, ) -> Result<SwhGraphProperties<MappedMaps<MPHF>, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Consumes a SwhGraphProperties
and returns a new one with these methods
available:
Source§impl<MAPS: Maps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to map between SWHID and node id.
impl<MAPS: Maps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to map between SWHID and node id.
Only available after calling load_contents
or load_all_properties
Sourcepub unsafe fn node_id_unchecked(&self, swhid: &SWHID) -> NodeId
pub unsafe fn node_id_unchecked(&self, swhid: &SWHID) -> NodeId
Returns the node id of the given SWHID
May return the id of a random node if the SWHID does not exist in the graph.
§Safety
Undefined behavior if the swhid does not exist.
Sourcepub fn node_id<T: TryInto<SWHID>>(
&self,
swhid: T,
) -> Result<NodeId, NodeIdFromSwhidError<<T as TryInto<SWHID>>::Error>>
pub fn node_id<T: TryInto<SWHID>>( &self, swhid: T, ) -> Result<NodeId, NodeIdFromSwhidError<<T as TryInto<SWHID>>::Error>>
Returns the node id of the given SWHID, or None
if it does not exist.
Sourcepub fn node_id_from_string_swhid<T: AsRef<str>>(
&self,
swhid: T,
) -> Result<NodeId, NodeIdFromSwhidError<StrSWHIDDeserializationError>>
pub fn node_id_from_string_swhid<T: AsRef<str>>( &self, swhid: T, ) -> Result<NodeId, NodeIdFromSwhidError<StrSWHIDDeserializationError>>
Specialized version of node_id
when the SWHID is a string
Under the hood, when using GOVMPH
,
node_id
serializes the SWHID to a string, which can be bottleneck.
This function skips the serialization by working directly on the string.
Sourcepub fn try_swhid(&self, node_id: NodeId) -> Result<SWHID, OutOfBoundError>
pub fn try_swhid(&self, node_id: NodeId) -> Result<SWHID, OutOfBoundError>
Returns the SWHID of a given node, or None
if the node id does not exist
Sourcepub fn try_node_type(
&self,
node_id: NodeId,
) -> Result<NodeType, OutOfBoundError>
pub fn try_node_type( &self, node_id: NodeId, ) -> Result<NodeType, OutOfBoundError>
Returns the type of a given node, or None
if the node id does not exist
Source§impl<MAPS: MaybeMaps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, NoTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS: MaybeMaps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, NoTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Sourcepub fn load_timestamps(
self,
) -> Result<SwhGraphProperties<MAPS, MappedTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn load_timestamps( self, ) -> Result<SwhGraphProperties<MAPS, MappedTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Consumes a SwhGraphProperties
and returns a new one with these methods
available:
Sourcepub fn opt_load_timestamps(
self,
) -> Result<SwhGraphProperties<MAPS, OptMappedTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn opt_load_timestamps( self, ) -> Result<SwhGraphProperties<MAPS, OptMappedTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Equivalent to Self::load_timestamps
that does not require all files to be present
Sourcepub fn with_timestamps<TIMESTAMPS: MaybeTimestamps>(
self,
timestamps: TIMESTAMPS,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn with_timestamps<TIMESTAMPS: MaybeTimestamps>( self, timestamps: TIMESTAMPS, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Alternative to load_timestamps
that allows using arbitrary
timestamps implementations
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: OptTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access timestamps of revision
and release
nodes
impl<MAPS: MaybeMaps, TIMESTAMPS: OptTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access timestamps of revision
and release
nodes
Only available after calling load_timestamps
or load_all_properties
Returns the number of seconds since Epoch that a release or revision was authored at
§Panics
If the node id does not exist
Returns the number of seconds since Epoch that a release or revision was authored at
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no author timestamp
Returns the UTC offset in minutes of a release or revision’s authorship date
§Panics
If the node id does not exist
Returns the UTC offset in minutes of a release or revision’s authorship date
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no author timestamp
Sourcepub fn committer_timestamp(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<i64>, TIMESTAMPS>
pub fn committer_timestamp( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<i64>, TIMESTAMPS>
Returns the number of seconds since Epoch that a revision was committed at
§Panics
If the node id does not exist
Sourcepub fn try_committer_timestamp(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<i64>, OutOfBoundError>, TIMESTAMPS>
pub fn try_committer_timestamp( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<i64>, OutOfBoundError>, TIMESTAMPS>
Returns the number of seconds since Epoch that a revision was committed at
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no committer timestamp
Sourcepub fn committer_timestamp_offset(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<i16>, TIMESTAMPS>
pub fn committer_timestamp_offset( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<i16>, TIMESTAMPS>
Returns the UTC offset in minutes of a revision’s committer date
§Panics
If the node id does not exist
Sourcepub fn try_committer_timestamp_offset(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<i16>, OutOfBoundError>, TIMESTAMPS>
pub fn try_committer_timestamp_offset( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<i16>, OutOfBoundError>, TIMESTAMPS>
Returns the UTC offset in minutes of a revision’s committer date
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no committer timestamp
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, NoPersons, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, NoPersons, CONTENTS, STRINGS, LABELNAMES>
Sourcepub fn load_persons(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, MappedPersons, CONTENTS, STRINGS, LABELNAMES>>
pub fn load_persons( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, MappedPersons, CONTENTS, STRINGS, LABELNAMES>>
Consumes a SwhGraphProperties
and returns a new one with these methods
available:
Sourcepub fn opt_load_persons(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, OptMappedPersons, CONTENTS, STRINGS, LABELNAMES>>
pub fn opt_load_persons( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, OptMappedPersons, CONTENTS, STRINGS, LABELNAMES>>
Equivalent to Self::load_persons
that does not require all files to be present
Sourcepub fn with_persons<PERSONS: MaybePersons>(
self,
persons: PERSONS,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn with_persons<PERSONS: MaybePersons>( self, persons: PERSONS, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Alternative to load_persons
that allows using arbitrary
persons implementations
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: OptPersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access the id of the author or committer of revision
/release
nodes.
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: OptPersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access the id of the author or committer of revision
/release
nodes.
Only available after calling load_persons
or load_all_properties
Returns the id of the author of a revision or release, if any
Returns Err
if the node id does not exist, and Ok(None)
if the node
has no author
Sourcepub fn committer_id(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<u32>, PERSONS>
pub fn committer_id( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<u32>, PERSONS>
Sourcepub fn try_committer_id(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<u32>, OutOfBoundError>, PERSONS>
pub fn try_committer_id( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<u32>, OutOfBoundError>, PERSONS>
Returns the id of the committer of a revision, if any
Returns None
if the node id does not exist, and Ok(None)
if the node
has no author
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, NoContents, STRINGS, LABELNAMES>
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, NoContents, STRINGS, LABELNAMES>
Sourcepub fn load_contents(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, MappedContents, STRINGS, LABELNAMES>>
pub fn load_contents( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, MappedContents, STRINGS, LABELNAMES>>
Consumes a SwhGraphProperties
and returns a new one with these methods
available:
Sourcepub fn opt_load_contents(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, OptMappedContents, STRINGS, LABELNAMES>>
pub fn opt_load_contents( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, OptMappedContents, STRINGS, LABELNAMES>>
Equivalent to Self::load_contents
that does not require all files to be present
Sourcepub fn with_contents<CONTENTS: MaybeContents>(
self,
contents: CONTENTS,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn with_contents<CONTENTS: MaybeContents>( self, contents: CONTENTS, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Alternative to load_contents
that allows using arbitrary
contents implementations
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: OptContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access properties of content
nodes
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: OptContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access properties of content
nodes
Only available after calling load_contents
or load_all_properties
Sourcepub fn is_skipped_content(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, bool, CONTENTS>
pub fn is_skipped_content( &self, node_id: NodeId, ) -> PropertiesResult<'_, bool, CONTENTS>
Returns whether the node is a skipped content
Non-content objects get a false
value, like non-skipped contents.
§Panics
If the node id does not exist.
Sourcepub fn try_is_skipped_content(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<bool, OutOfBoundError>, CONTENTS>
pub fn try_is_skipped_content( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<bool, OutOfBoundError>, CONTENTS>
Returns whether the node is a skipped content, or Err
if the node id does not exist
Non-content objects get a false
value, like non-skipped contents.
Sourcepub fn content_length(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<u64>, CONTENTS>
pub fn content_length( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<u64>, CONTENTS>
Returns the length of the given content.
May be None
for skipped contents
§Panics
If the node id does not exist.
Sourcepub fn try_content_length(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<u64>, OutOfBoundError>, CONTENTS>
pub fn try_content_length( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<u64>, OutOfBoundError>, CONTENTS>
Returns the length of the given content, or Err
if the node id does not exist
May be Ok(None)
for skipped contents
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, NoStrings, LABELNAMES>
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, NoStrings, LABELNAMES>
Sourcepub fn load_strings(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, MappedStrings, LABELNAMES>>
pub fn load_strings( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, MappedStrings, LABELNAMES>>
Consumes a SwhGraphProperties
and returns a new one with these methods
available:
Sourcepub fn opt_load_strings(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, OptMappedStrings, LABELNAMES>>
pub fn opt_load_strings( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, OptMappedStrings, LABELNAMES>>
Equivalent to Self::load_strings
that does not require all files to be present
Sourcepub fn with_strings<STRINGS: MaybeStrings>(
self,
strings: STRINGS,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn with_strings<STRINGS: MaybeStrings>( self, strings: STRINGS, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Alternative to load_strings
that allows using arbitrary
strings implementations
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: OptStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access message of revision
/release
nodes, and names of release
nodes
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: OptStrings, LABELNAMES: MaybeLabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access message of revision
/release
nodes, and names of release
nodes
Only available after calling load_strings
or load_all_properties
Sourcepub fn message_base64(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<&[u8]>, STRINGS>
pub fn message_base64( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<&[u8]>, STRINGS>
Returns the base64-encoded message of a revision or release, or the base64-encoded URL of an origin
§Panics
If the node id does not exist
Sourcepub fn try_message_base64(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<&[u8]>, OutOfBoundError>, STRINGS>
pub fn try_message_base64( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<&[u8]>, OutOfBoundError>, STRINGS>
Returns the base64-encoded message of a revision or release
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no message.
Sourcepub fn message(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<Vec<u8>>, STRINGS>
pub fn message( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<Vec<u8>>, STRINGS>
Returns the message of a revision or release, or the URL of an origin
§Panics
If the node id does not exist
Sourcepub fn try_message(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<Vec<u8>>, OutOfBoundError>, STRINGS>
pub fn try_message( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<Vec<u8>>, OutOfBoundError>, STRINGS>
Returns the message of a revision or release, or the URL of an origin
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no message.
Sourcepub fn tag_name_base64(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Option<&[u8]>, STRINGS>
pub fn tag_name_base64( &self, node_id: NodeId, ) -> PropertiesResult<'_, Option<&[u8]>, STRINGS>
Sourcepub fn try_tag_name_base64(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<&[u8]>, OutOfBoundError>, STRINGS>
pub fn try_tag_name_base64( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<&[u8]>, OutOfBoundError>, STRINGS>
Returns the tag name of a release, base64-encoded
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no tag name.
Sourcepub fn try_tag_name(
&self,
node_id: NodeId,
) -> PropertiesResult<'_, Result<Option<Vec<u8>>, OutOfBoundError>, STRINGS>
pub fn try_tag_name( &self, node_id: NodeId, ) -> PropertiesResult<'_, Result<Option<Vec<u8>>, OutOfBoundError>, STRINGS>
Returns the tag name of a release
Returns Err
if the node id is unknown, and Ok(None)
if the node has
no tag name.
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, NoLabelNames>
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, NoLabelNames>
Sourcepub fn load_label_names(
self,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, MappedLabelNames>>
pub fn load_label_names( self, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, MappedLabelNames>>
Consumes a SwhGraphProperties
and returns a new one with this methods
available:
Sourcepub fn with_label_names<LABELNAMES: MaybeLabelNames>(
self,
label_names: LABELNAMES,
) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
pub fn with_label_names<LABELNAMES: MaybeLabelNames>( self, label_names: LABELNAMES, ) -> Result<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>>
Alternative to load_label_names
that allows using
arbitrary label_names implementations
Source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: LabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access names of arc labels.
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: LabelNames> SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
Functions to access names of arc labels.
Only available after calling load_label_names
or load_all_properties
.
Sourcepub fn num_label_names(&self) -> u64
pub fn num_label_names(&self) -> u64
Returns the total number of labels in the graph
Sourcepub fn iter_label_name_ids(&self) -> impl Iterator<Item = LabelNameId>
pub fn iter_label_name_ids(&self) -> impl Iterator<Item = LabelNameId>
Returns an iterator on LabelNameId
s for this graph
Sourcepub fn par_iter_label_name_ids(
&self,
) -> impl ParallelIterator<Item = LabelNameId>
pub fn par_iter_label_name_ids( &self, ) -> impl ParallelIterator<Item = LabelNameId>
Returns an iterator on LabelNameId
s for this graph
Sourcepub fn label_name_base64(&self, label_name_id: LabelNameId) -> Vec<u8> ⓘ
pub fn label_name_base64(&self, label_name_id: LabelNameId) -> Vec<u8> ⓘ
Returns the base64-encoded name of an arc label
This is the file name (resp. branch name) of a label on an arc from a directory (resp. snapshot)
§Panics
If label_name_id
does not exist
Sourcepub fn try_label_name_base64(
&self,
label_name_id: LabelNameId,
) -> Result<Vec<u8>, OutOfBoundError>
pub fn try_label_name_base64( &self, label_name_id: LabelNameId, ) -> Result<Vec<u8>, OutOfBoundError>
Returns the base64-encoded name of an arc label
This is the file name (resp. branch name) of a label on an arc from a directory (resp. snapshot)
Sourcepub fn label_name(&self, label_name_id: LabelNameId) -> Vec<u8> ⓘ
pub fn label_name(&self, label_name_id: LabelNameId) -> Vec<u8> ⓘ
Returns the name of an arc label
This is the file name (resp. branch name) of a label on an arc from a directory (resp. snapshot)
§Panics
If label_name_id
does not exist
Sourcepub fn try_label_name(
&self,
label_name_id: LabelNameId,
) -> Result<Vec<u8>, OutOfBoundError>
pub fn try_label_name( &self, label_name_id: LabelNameId, ) -> Result<Vec<u8>, OutOfBoundError>
Returns the name of an arc label
This is the file name (resp. branch name) of a label on an arc from a directory (resp. snapshot)
Sourcepub fn label_name_id(
&self,
name: impl AsRef<[u8]>,
) -> Result<LabelNameId, LabelIdFromNameError>
pub fn label_name_id( &self, name: impl AsRef<[u8]>, ) -> Result<LabelNameId, LabelIdFromNameError>
Given a branch/file name, returns the label_name id used by edges with that name,
or None
if it does not exist.
This is the inverse function of label_name
Unlike in Java where this function is O(1)
, this implementation is O(log2(num_labels))
because it uses a binary search, as the MPH function can only be read from Java.
Source§impl SwhGraphProperties<NoMaps, NoTimestamps, NoPersons, NoContents, NoStrings, NoLabelNames>
impl SwhGraphProperties<NoMaps, NoTimestamps, NoPersons, NoContents, NoStrings, NoLabelNames>
Sourcepub fn new(path: impl AsRef<Path>, num_nodes: usize) -> Self
pub fn new(path: impl AsRef<Path>, num_nodes: usize) -> Self
Creates an empty SwhGraphProperties
instance, which will load properties
from the given path prefix.
Sourcepub fn load_all<MPHF: LoadableSwhidMphf>(
self,
) -> Result<AllSwhGraphProperties<MPHF>>
pub fn load_all<MPHF: LoadableSwhidMphf>( self, ) -> Result<AllSwhGraphProperties<MPHF>>
Consumes an empty SwhGraphProperties
instance and returns a new one
with all properties loaded and all methods available.
use swh_graph::graph::SwhGraphWithProperties;
use swh_graph::mph::DynMphf;
use swh_graph::SwhGraphProperties;
SwhGraphProperties::new(PathBuf::from("./graph"), 123)
.load_all::<DynMphf>()
.expect("Could not load properties");
is equivalent to:
use swh_graph::mph::DynMphf;
use swh_graph::SwhGraphProperties;
SwhGraphProperties::new(PathBuf::from("./graph"), 123)
.load_maps::<DynMphf>()
.expect("Could not load node2swhid/swhid2node")
.load_timestamps()
.expect("Could not load timestamp properties")
.load_persons()
.expect("Could not load person properties")
.load_contents()
.expect("Could not load content properties")
.load_strings()
.expect("Could not load string properties");
Auto Trait Implementations§
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> !Freeze for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> RefUnwindSafe for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>where
MAPS: RefUnwindSafe,
TIMESTAMPS: RefUnwindSafe,
PERSONS: RefUnwindSafe,
CONTENTS: RefUnwindSafe,
STRINGS: RefUnwindSafe,
LABELNAMES: RefUnwindSafe,
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> Send for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> Sync for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> Unpin for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
impl<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES> UnwindSafe for SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>where
MAPS: UnwindSafe,
TIMESTAMPS: UnwindSafe,
PERSONS: UnwindSafe,
CONTENTS: UnwindSafe,
STRINGS: UnwindSafe,
LABELNAMES: UnwindSafe,
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, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
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> 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, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.