pub trait Partitionwhere
Self: Sized,{
// Required methods
fn partition_by_attrib<T: AttributeValueHash, Src: AttribIndex<Self>>(
&self,
attrib: &str
) -> (Vec<usize>, usize);
fn partition_by_attrib_by_sort<T: PartialOrd + AttributeValue, Src: AttribIndex<Self>>(
&self,
attrib: &str
) -> (Vec<usize>, usize);
}
Required Methods§
sourcefn partition_by_attrib<T: AttributeValueHash, Src: AttribIndex<Self>>(
&self,
attrib: &str
) -> (Vec<usize>, usize)
fn partition_by_attrib<T: AttributeValueHash, Src: AttribIndex<Self>>( &self, attrib: &str ) -> (Vec<usize>, usize)
Returns a partitioning by unique values of the given attribute.
The returned vector consists of a ID assigned to each Src
element identifying which
partition it belongs to along with the total number of partitions.
The attribute values must have type T
.
If attrib
doesn’t exist at the Src
topology, the returned vector will consist of all
zeros and the number of partitions will be 1.
sourcefn partition_by_attrib_by_sort<T: PartialOrd + AttributeValue, Src: AttribIndex<Self>>(
&self,
attrib: &str
) -> (Vec<usize>, usize)
fn partition_by_attrib_by_sort<T: PartialOrd + AttributeValue, Src: AttribIndex<Self>>( &self, attrib: &str ) -> (Vec<usize>, usize)
Returns a partitioning by unique values of the given attribute.
The returned vector consists of a ID assigned to each Src
element identifying which
partition it belongs to along with the total number of partitions.
The attribute values must have type T
.
If attrib
doesn’t exist at the Src
topology, the returned vector will consist of all
zeros and the number of partitions will be 1.
This version of partition_by_attrib
uses sorting to determine unique values instead of a
HashMap
, and therefore only relies on T
being PartialOrd
but not Eq
and Hash
.