Enum hwlocality::topology::editor::GroupChildFilter

source ·
pub enum GroupChildFilter<NormalFilter = fn(_: &TopologyObject) -> bool, MemoryFilter = fn(_: &TopologyObject) -> bool>
where NormalFilter: FnMut(&TopologyObject) -> bool, MemoryFilter: FnMut(&TopologyObject) -> bool,
{ Normal(NormalFilter), Memory(MemoryFilter), Mixed { strict: bool, normal: NormalFilter, memory: MemoryFilter, }, }
Available on crate feature hwloc-2_3_0 only.
Expand description

Callbacks that selects the members of a proposed group object

The basic workflow of TopologyEditor::insert_group_object() is that you first specify which topology object should be the parent of the newly created group, and then you specify (using this enum and its inner callbacks) which of the normal and memory children of this parent object should become members of the newly created group.

However, as an extra complication, you must live with the fact that hwloc only supports groups whose normal and memory member lists follow the following consistency rules:

  1. If a memory object is a member of a group, then all normal objects which are attached to this memory object (as evidenced by their PUs being part of that memory object’s cpuset) must also be members of this group.
  2. Conversely, if all normal objects which are attached to a memory object are members of a group, then this memory object must also be made a member of this group.

Because following these rules by hand is unpleasant, we provide various shortcuts which allow you to only specify a subset of the group’s members, and let the remaining members required to follow the consistency rules be added to the group automatically.

Variants§

§

Normal(NormalFilter)

Pick the group’s normal children in the parent’s normal children list

Each normal child of the designated parent will be passed to the provided callback, which will tell if this child should be made a member of the group (true) or not (false), as in Iterator::filter().

Memory children will then be automatically added in order to produce a group member set that follows the consistency rules.

Due to a limitation of the Rust compiler, as of Rust 1.75 this type constructor mistakenly requires you to specify a MemoryFilter type parameter. You can work around this by using the Self::normal() constructor instead.

§

Memory(MemoryFilter)

Pick the group’s memory children in the parent’s memory children list

Works like Normal, except the provided filter is used to select memory children instead of normal children, and it is normal children that get automatically added to follow the consistency rules.

Due to a limitation of the Rust compiler, as of Rust 1.75 this type constructor mistakenly requires you to specify a NormalFilter type parameter. You can work around this by using the Self::memory() constructor instead.

§

Mixed

Pick the group’s normal and memory children

The normal and memory children of the designated parent are traversed and filtered using the normal and memory filters respectively, as in the Normal and Memory cases.

The resulting normal and memory children sets may or may not be subsequently expanded to follow the consistency rules, depending on the value of the strict flag.

Fields

§strict: bool

Error out when normal and memory don’t pick consistent sets

If this flag isn’t set, then after the normal and memory callbacks have picked preliminary normal and memory children lists, these normal and memory children lists are automatically expanded to honor the consistency rules. This gives you the smallest valid hwloc group that contains at least the children you asked for, at the cost of possibly getting extra children that you did not expect, which your code must handle gracefully.

If this flag is set, then you are responsible for picking normal and memory children sets that honor the consistency rules, and TopologyEditor::insert_group_object() will fail if you don’t. This is for situations where getting unexpected extra group members is unacceptable, and you are ready to go through the burden of applying the consistency rules yourself in order to avoid this outcome.

§normal: NormalFilter

Filter that selects the future group’s normal children amongst the parent’s normal children list, as in Normal

§memory: MemoryFilter

Filter that selects the future group’s memory children amongst the parent’s memory children list, as in Memory

Implementations§

source§

impl<NormalFilter> GroupChildFilter<NormalFilter, fn(_: &TopologyObject) -> bool>
where NormalFilter: FnMut(&TopologyObject) -> bool,

source

pub fn normal(filter: NormalFilter) -> Self

Workaround for lack of default type parameter fallback when using the Self::Normal type constructor

source§

impl<MemoryFilter> GroupChildFilter<fn(_: &TopologyObject) -> bool, MemoryFilter>
where MemoryFilter: FnMut(&TopologyObject) -> bool,

source

pub fn memory(filter: MemoryFilter) -> Self

Workaround for lack of default type parameter fallback when using the Self::Memory type constructor

Trait Implementations§

source§

impl<NormalFilter, MemoryFilter> Clone for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: FnMut(&TopologyObject) -> bool + Clone, MemoryFilter: FnMut(&TopologyObject) -> bool + Clone,

source§

fn clone(&self) -> GroupChildFilter<NormalFilter, MemoryFilter>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<NormalFilter, MemoryFilter> Debug for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: FnMut(&TopologyObject) -> bool, MemoryFilter: FnMut(&TopologyObject) -> bool,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<NormalFilter, MemoryFilter> Copy for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: FnMut(&TopologyObject) -> bool + Copy, MemoryFilter: FnMut(&TopologyObject) -> bool + Copy,

Auto Trait Implementations§

§

impl<NormalFilter, MemoryFilter> Freeze for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: Freeze, MemoryFilter: Freeze,

§

impl<NormalFilter, MemoryFilter> RefUnwindSafe for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: RefUnwindSafe, MemoryFilter: RefUnwindSafe,

§

impl<NormalFilter, MemoryFilter> Send for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: Send, MemoryFilter: Send,

§

impl<NormalFilter, MemoryFilter> Sync for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: Sync, MemoryFilter: Sync,

§

impl<NormalFilter, MemoryFilter> Unpin for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: Unpin, MemoryFilter: Unpin,

§

impl<NormalFilter, MemoryFilter> UnwindSafe for GroupChildFilter<NormalFilter, MemoryFilter>
where NormalFilter: UnwindSafe, MemoryFilter: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V