#![allow(non_camel_case_types, unknown_lints)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, doc(cfg_hide(doc)))]
#![deny(
clippy::as_ptr_cast_mut,
clippy::as_underscore,
clippy::assertions_on_result_states,
clippy::bool_to_int_with_if,
clippy::borrow_as_ptr,
clippy::branches_sharing_code,
clippy::cargo_common_metadata,
clippy::case_sensitive_file_extension_comparisons,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::cast_ptr_alignment,
clippy::cast_sign_loss,
clippy::checked_conversions,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::cloned_instead_of_copied,
clippy::cognitive_complexity,
clippy::collection_is_never_read,
clippy::create_dir,
clippy::debug_assert_with_mut_call,
clippy::decimal_literal_representation,
clippy::derive_partial_eq_without_eq,
clippy::doc_link_with_quotes,
clippy::doc_markdown,
clippy::empty_drop,
clippy::empty_line_after_doc_comments,
clippy::empty_line_after_outer_attr,
clippy::empty_structs_with_brackets,
clippy::enum_glob_use,
clippy::equatable_if_let,
clippy::exit,
clippy::expl_impl_clone_on_copy,
clippy::explicit_deref_methods,
clippy::explicit_into_iter_loop,
clippy::explicit_iter_loop,
clippy::fallible_impl_from,
clippy::filter_map_next,
clippy::flat_map_option,
clippy::float_cmp,
clippy::float_cmp_const,
clippy::fn_to_numeric_cast_any,
clippy::format_push_string,
clippy::from_iter_instead_of_collect,
clippy::get_unwrap,
clippy::if_not_else,
clippy::if_then_some_else_none,
clippy::implicit_clone,
clippy::implicit_hasher,
clippy::imprecise_flops,
clippy::index_refutable_slice,
clippy::inline_always,
clippy::invalid_upcast_comparisons,
clippy::iter_not_returning_iterator,
clippy::iter_on_empty_collections,
clippy::iter_on_single_items,
clippy::large_digit_groups,
clippy::large_stack_arrays,
clippy::large_types_passed_by_value,
clippy::linkedlist,
clippy::macro_use_imports,
clippy::manual_assert,
clippy::manual_clamp,
clippy::manual_instant_elapsed,
clippy::manual_let_else,
clippy::manual_ok_or,
clippy::manual_string_new,
clippy::many_single_char_names,
clippy::map_unwrap_or,
clippy::match_bool,
clippy::match_same_arms,
clippy::match_wildcard_for_single_variants,
clippy::mismatching_type_param_order,
clippy::missing_assert_message,
clippy::missing_docs_in_private_items,
clippy::missing_errors_doc,
clippy::missing_fields_in_debug,
clippy::mixed_read_write_in_expression,
clippy::mut_mut,
clippy::mutex_atomic,
clippy::mutex_integer,
clippy::naive_bytecount,
clippy::needless_collect,
clippy::needless_continue,
clippy::needless_for_each,
clippy::negative_feature_names,
clippy::no_mangle_with_rust_abi,
clippy::non_send_fields_in_send_ty,
clippy::nonstandard_macro_braces,
clippy::option_if_let_else,
clippy::option_option,
clippy::or_fun_call,
clippy::partial_pub_fields,
clippy::path_buf_push_overwrite,
clippy::print_stdout,
clippy::ptr_as_ptr,
clippy::ptr_cast_constness,
clippy::pub_without_shorthand,
clippy::range_minus_one,
clippy::range_plus_one,
clippy::rc_buffer,
clippy::rc_mutex,
clippy::redundant_clone,
clippy::redundant_closure_for_method_calls,
clippy::redundant_feature_names,
clippy::ref_option_ref,
clippy::ref_patterns,
clippy::rest_pat_in_fully_bound_structs,
clippy::same_functions_in_if_condition,
clippy::self_named_module_files,
clippy::semicolon_inside_block,
clippy::semicolon_outside_block,
clippy::significant_drop_in_scrutinee,
clippy::similar_names,
clippy::single_match_else,
clippy::str_to_string,
clippy::string_add,
clippy::string_lit_as_bytes,
clippy::suboptimal_flops,
clippy::suspicious_operation_groupings,
clippy::tests_outside_test_module,
clippy::todo,
clippy::too_many_lines,
clippy::trailing_empty_array,
clippy::transmute_ptr_to_ptr,
clippy::trivial_regex,
clippy::trivially_copy_pass_by_ref,
clippy::try_err,
clippy::type_repetition_in_bounds,
clippy::undocumented_unsafe_blocks,
clippy::unicode_not_nfc,
clippy::unimplemented,
clippy::uninlined_format_args,
clippy::unnecessary_box_returns,
clippy::unnecessary_join,
clippy::unnecessary_safety_comment,
clippy::unnecessary_safety_doc,
clippy::unnecessary_self_imports,
clippy::unnecessary_struct_initialization,
clippy::unnecessary_wraps,
clippy::unneeded_field_pattern,
clippy::unnested_or_patterns,
clippy::unreadable_literal,
clippy::unsafe_derive_deserialize,
clippy::unused_async,
clippy::unused_peekable,
clippy::unused_rounding,
clippy::unwrap_used,
clippy::use_self,
clippy::used_underscore_binding,
clippy::useless_let_if_seq,
clippy::verbose_bit_mask,
clippy::verbose_file_reads,
clippy::wildcard_dependencies,
clippy::wildcard_enum_match_arm,
clippy::wildcard_imports,
clippy::zero_sized_map_values,
invalid_reference_casting,
macro_use_extern_crate,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
// FIXME: Bring back missing_docs,
non_ascii_idents,
rust_2018_compatibility,
rust_2021_compatibility,
rustdoc::bare_urls,
rustdoc::broken_intra_doc_links,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_html_tags,
rustdoc::invalid_rust_codeblocks,
rustdoc::missing_crate_level_docs,
rustdoc::private_intra_doc_links,
rustdoc::unescaped_backticks,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
variant_size_differences
)]
#![warn(
clippy::dbg_macro,
clippy::print_stderr,
clippy::use_debug,
future_incompatible,
keyword_idents,
let_underscore,
meta_variable_misuse,
noop_method_call,
rust_2018_idioms,
unused
)]
#![doc = include_str!("../README.md")]
#[cfg(target_os = "linux")]
use libc::pid_t;
#[cfg(doc)]
use std::panic::UnwindSafe;
use std::{
cell::UnsafeCell,
ffi::{c_char, c_float, c_int, c_uchar, c_uint, c_ulong, c_ushort, c_void},
fmt::Debug,
marker::{PhantomData, PhantomPinned},
panic::RefUnwindSafe,
ptr,
};
#[cfg(all(doc, not(target_os = "linux")))]
pub type pid_t = c_int;
#[repr(C)]
struct IncompleteType {
_data: [u8; 0],
_marker: PhantomData<(*mut u8, PhantomPinned, &'static UnsafeCell<u8>)>,
}
#[cfg(target_os = "windows")]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type hwloc_thread_t = windows_sys::Win32::Foundation::HANDLE;
#[cfg(target_os = "windows")]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type hwloc_pid_t = u32;
#[cfg(not(any(target_os = "windows", target_env = "musl")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type hwloc_thread_t = libc::pthread_t;
#[cfg(target_env = "musl")]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type hwloc_thread_t = c_ulong;
#[cfg(not(target_os = "windows"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type hwloc_pid_t = libc::pid_t;
pub type hwloc_const_cpuset_t = hwloc_const_bitmap_t;
pub type hwloc_const_nodeset_t = hwloc_const_bitmap_t;
pub type hwloc_cpuset_t = hwloc_bitmap_t;
pub type hwloc_nodeset_t = hwloc_bitmap_t;
pub const HWLOC_TYPE_UNORDERED: c_int = c_int::MAX;
#[doc(alias = "hwloc_obj_bridge_type_e")]
pub type hwloc_obj_bridge_type_t = c_uint;
pub const HWLOC_OBJ_BRIDGE_HOST: hwloc_obj_bridge_type_t = 0;
pub const HWLOC_OBJ_BRIDGE_PCI: hwloc_obj_bridge_type_t = 1;
#[doc(alias = "hwloc_obj_cache_type_e")]
pub type hwloc_obj_cache_type_t = c_uint;
pub const HWLOC_OBJ_CACHE_UNIFIED: hwloc_obj_cache_type_t = 0;
pub const HWLOC_OBJ_CACHE_DATA: hwloc_obj_cache_type_t = 1;
pub const HWLOC_OBJ_CACHE_INSTRUCTION: hwloc_obj_cache_type_t = 2;
#[doc(alias = "hwloc_obj_osdev_type_e")]
pub type hwloc_obj_osdev_type_t = c_uint;
#[doc(alias = "HWLOC_OBJ_OSDEV_BLOCK")]
pub const HWLOC_OBJ_OSDEV_STORAGE: hwloc_obj_osdev_type_t = 0;
pub const HWLOC_OBJ_OSDEV_GPU: hwloc_obj_osdev_type_t = 1;
pub const HWLOC_OBJ_OSDEV_NETWORK: hwloc_obj_osdev_type_t = 2;
#[allow(clippy::doc_markdown)]
pub const HWLOC_OBJ_OSDEV_OPENFABRICS: hwloc_obj_osdev_type_t = 3;
#[allow(clippy::doc_markdown)]
pub const HWLOC_OBJ_OSDEV_DMA: hwloc_obj_osdev_type_t = 4;
#[allow(clippy::doc_markdown)]
pub const HWLOC_OBJ_OSDEV_COPROC: hwloc_obj_osdev_type_t = 5;
#[allow(clippy::doc_markdown)]
#[cfg(feature = "hwloc-3_0_0")]
pub const HWLOC_OBJ_OSDEV_MEMORY: hwloc_obj_osdev_type_t = 6;
#[doc(alias = "hwloc_obj_type_e")]
pub type hwloc_obj_type_t = c_uint;
pub const HWLOC_OBJ_MACHINE: hwloc_obj_type_t = 0;
pub const HWLOC_OBJ_PACKAGE: hwloc_obj_type_t = 1;
pub const HWLOC_OBJ_CORE: hwloc_obj_type_t = 2;
pub const HWLOC_OBJ_PU: hwloc_obj_type_t = 3;
pub const HWLOC_OBJ_L1CACHE: hwloc_obj_type_t = 4;
pub const HWLOC_OBJ_L2CACHE: hwloc_obj_type_t = 5;
pub const HWLOC_OBJ_L3CACHE: hwloc_obj_type_t = 6;
pub const HWLOC_OBJ_L4CACHE: hwloc_obj_type_t = 7;
pub const HWLOC_OBJ_L5CACHE: hwloc_obj_type_t = 8;
pub const HWLOC_OBJ_L1ICACHE: hwloc_obj_type_t = 9;
pub const HWLOC_OBJ_L2ICACHE: hwloc_obj_type_t = 10;
pub const HWLOC_OBJ_L3ICACHE: hwloc_obj_type_t = 11;
pub const HWLOC_OBJ_GROUP: hwloc_obj_type_t = 12;
pub const HWLOC_OBJ_NUMANODE: hwloc_obj_type_t = 13;
pub const HWLOC_OBJ_BRIDGE: hwloc_obj_type_t = 14;
pub const HWLOC_OBJ_PCI_DEVICE: hwloc_obj_type_t = 15;
pub const HWLOC_OBJ_OS_DEVICE: hwloc_obj_type_t = 16;
pub const HWLOC_OBJ_MISC: hwloc_obj_type_t = 17;
#[cfg(feature = "hwloc-2_1_0")]
pub const HWLOC_OBJ_MEMCACHE: hwloc_obj_type_t = 18;
#[cfg(feature = "hwloc-2_1_0")]
pub const HWLOC_OBJ_DIE: hwloc_obj_type_t = 19;
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct hwloc_obj {
#[doc(alias = "hwloc_obj::type")]
pub ty: hwloc_obj_type_t,
pub subtype: *mut c_char,
pub os_index: c_uint,
pub name: *mut c_char,
pub total_memory: u64,
pub attr: *mut hwloc_obj_attr_u,
pub depth: hwloc_get_type_depth_e,
pub logical_index: c_uint,
pub next_cousin: hwloc_obj_t,
pub prev_cousin: hwloc_obj_t,
pub parent: hwloc_obj_t,
pub sibling_rank: c_uint,
pub next_sibling: hwloc_obj_t,
pub prev_sibling: hwloc_obj_t,
pub arity: c_uint,
pub children: *mut hwloc_obj_t,
pub first_child: hwloc_obj_t,
pub last_child: hwloc_obj_t,
pub symmetric_subtree: c_int,
pub memory_arity: c_uint,
pub memory_first_child: hwloc_obj_t,
pub io_arity: c_uint,
pub io_first_child: hwloc_obj_t,
pub misc_arity: c_uint,
pub misc_first_child: hwloc_obj_t,
pub cpuset: hwloc_cpuset_t,
pub complete_cpuset: hwloc_cpuset_t,
#[cfg_attr(
feature = "hwloc-2_3_0",
doc = "With hwloc 2.3+, [`hwloc_get_local_numanode_objs()`] may be used to"
)]
#[cfg_attr(feature = "hwloc-2_3_0", doc = "list those NUMA nodes more precisely.")]
pub nodeset: hwloc_nodeset_t,
pub complete_nodeset: hwloc_nodeset_t,
pub infos: *mut hwloc_info_s,
pub infos_count: c_uint,
pub userdata: *mut c_void,
pub gp_index: u64,
}
pub const HWLOC_UNKNOWN_INDEX: c_uint = c_uint::MAX;
pub type hwloc_obj_t = *mut hwloc_obj;
#[derive(Copy, Clone)]
#[repr(C)]
pub union hwloc_obj_attr_u {
pub numa: hwloc_numanode_attr_s,
pub cache: hwloc_cache_attr_s,
pub group: hwloc_group_attr_s,
pub pcidev: hwloc_pcidev_attr_s,
pub bridge: hwloc_bridge_attr_s,
pub osdev: hwloc_osdev_attr_s,
}
impl Debug for hwloc_obj_attr_u {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("hwloc_obj_attr_u").finish_non_exhaustive()
}
}
#[derive(Copy, Clone, Debug)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s")]
#[repr(C)]
pub struct hwloc_numanode_attr_s {
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::local_memory")]
pub local_memory: u64,
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::page_types_len")]
pub page_types_len: c_uint,
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::page_types")]
pub page_types: *mut hwloc_memory_page_type_s,
}
impl Default for hwloc_numanode_attr_s {
fn default() -> Self {
Self {
local_memory: 0,
page_types_len: 0,
page_types: std::ptr::null_mut(),
}
}
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[doc(alias = "hwloc_numanode_attr_s::hwloc_memory_page_type_s")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::hwloc_memory_page_type_s")]
#[repr(C)]
pub struct hwloc_memory_page_type_s {
#[doc(alias = "hwloc_numanode_attr_s::hwloc_memory_page_type_s::size")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::hwloc_memory_page_type_s::size")]
pub size: u64,
#[doc(alias = "hwloc_numanode_attr_s::hwloc_memory_page_type_s::count")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_numanode_attr_s::hwloc_memory_page_type_s::count")]
pub count: u64,
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s")]
#[repr(C)]
pub struct hwloc_cache_attr_s {
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s::size")]
pub size: u64,
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s::depth")]
pub depth: c_uint,
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s::linesize")]
pub linesize: c_uint,
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s::associativity")]
pub associativity: c_int,
#[doc(alias = "hwloc_cache_attr_s::type")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_cache_attr_s::type")]
pub ty: hwloc_obj_cache_type_t,
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_group_attr_s")]
#[repr(C)]
pub struct hwloc_group_attr_s {
#[doc(alias = "hwloc_obj_attr_u::hwloc_group_attr_s::depth")]
pub depth: c_uint,
#[doc(alias = "hwloc_obj_attr_u::hwloc_group_attr_s::kind")]
pub kind: c_uint,
#[doc(alias = "hwloc_obj_attr_u::hwloc_group_attr_s::subkind")]
pub subkind: c_uint,
#[cfg(feature = "hwloc-2_0_4")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_group_attr_s::dont_merge")]
pub dont_merge: c_uchar,
}
#[cfg(feature = "hwloc-3_0_0")]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type PCIDomain = u32;
#[cfg(not(feature = "hwloc-3_0_0"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type PCIDomain = u16;
#[derive(Copy, Clone, Debug, Default, PartialEq)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s")]
#[repr(C)]
pub struct hwloc_pcidev_attr_s {
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::domain")]
pub domain: PCIDomain,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::bus")]
pub bus: c_uchar,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::dev")]
pub dev: c_uchar,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::func")]
pub func: c_uchar,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::class_id")]
pub class_id: c_ushort,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::vendor_id")]
pub vendor_id: c_ushort,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::device_id")]
pub device_id: c_ushort,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::subvendor_id")]
pub subvendor_id: c_ushort,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::subdevice_id")]
pub subdevice_id: c_ushort,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::revision")]
pub revision: c_uchar,
#[doc(alias = "hwloc_obj_attr_u::hwloc_pcidev_attr_s::linkspeed")]
pub linkspeed: c_float,
}
#[derive(Copy, Clone, Debug)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_bridge_attr_s")]
#[repr(C)]
pub struct hwloc_bridge_attr_s {
#[doc(alias = "hwloc_bridge_attr_s::upstream")]
pub upstream: RawUpstreamAttributes,
#[doc(alias = "hwloc_obj_attr_u::hwloc_bridge_attr_s::upstream_type")]
pub upstream_type: hwloc_obj_bridge_type_t,
#[doc(alias = "hwloc_obj_attr_u::hwloc_bridge_attr_s::downstream")]
pub downstream: RawDownstreamAttributes,
#[doc(alias = "hwloc_obj_attr_u::hwloc_bridge_attr_s::downstream_type")]
pub downstream_type: hwloc_obj_bridge_type_t,
#[doc(alias = "hwloc_obj_attr_u::hwloc_bridge_attr_s::depth")]
pub depth: c_uint,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union RawUpstreamAttributes {
pub pci: hwloc_pcidev_attr_s,
}
impl Debug for RawUpstreamAttributes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RawUpstreamAttributes")
.finish_non_exhaustive()
}
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[repr(C)]
pub struct RawDownstreamPCIAttributes {
pub domain: PCIDomain,
pub secondary_bus: c_uchar,
pub subordinate_bus: c_uchar,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union RawDownstreamAttributes {
pub pci: RawDownstreamPCIAttributes,
}
impl Debug for RawDownstreamAttributes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RawDownstreamAttributes")
.finish_non_exhaustive()
}
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[doc(alias = "hwloc_obj_attr_u::hwloc_osdev_attr_s")]
#[repr(C)]
pub struct hwloc_osdev_attr_s {
#[doc(alias = "hwloc_osdev_attr_s::type")]
#[doc(alias = "hwloc_obj_attr_u::hwloc_osdev_attr_s::type")]
pub ty: hwloc_obj_osdev_type_t,
}
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct hwloc_info_s {
pub name: *mut c_char,
pub value: *mut c_char,
}
#[allow(missing_debug_implementations)]
#[repr(C)]
pub struct hwloc_topology(IncompleteType);
impl RefUnwindSafe for hwloc_topology {}
pub type hwloc_topology_t = *mut hwloc_topology;
pub type hwloc_const_topology_t = *const hwloc_topology;
pub type hwloc_get_type_depth_e = c_int;
pub const HWLOC_TYPE_DEPTH_UNKNOWN: hwloc_get_type_depth_e = -1;
pub const HWLOC_TYPE_DEPTH_MULTIPLE: hwloc_get_type_depth_e = -2;
pub const HWLOC_TYPE_DEPTH_NUMANODE: hwloc_get_type_depth_e = -3;
pub const HWLOC_TYPE_DEPTH_BRIDGE: hwloc_get_type_depth_e = -4;
pub const HWLOC_TYPE_DEPTH_PCI_DEVICE: hwloc_get_type_depth_e = -5;
pub const HWLOC_TYPE_DEPTH_OS_DEVICE: hwloc_get_type_depth_e = -6;
pub const HWLOC_TYPE_DEPTH_MISC: hwloc_get_type_depth_e = -7;
#[cfg(feature = "hwloc-2_1_0")]
pub const HWLOC_TYPE_DEPTH_MEMCACHE: hwloc_get_type_depth_e = -8;
pub type hwloc_cpubind_flags_t = c_int;
pub const HWLOC_CPUBIND_THREAD: hwloc_cpubind_flags_t = 1 << 1;
pub const HWLOC_CPUBIND_PROCESS: hwloc_cpubind_flags_t = 1 << 0;
pub const HWLOC_CPUBIND_STRICT: hwloc_cpubind_flags_t = 1 << 2;
pub const HWLOC_CPUBIND_NOMEMBIND: hwloc_cpubind_flags_t = 1 << 3;
pub type hwloc_membind_flags_t = c_int;
pub const HWLOC_MEMBIND_PROCESS: hwloc_membind_flags_t = 1 << 0;
pub const HWLOC_MEMBIND_THREAD: hwloc_membind_flags_t = 1 << 1;
pub const HWLOC_MEMBIND_STRICT: hwloc_membind_flags_t = 1 << 2;
pub const HWLOC_MEMBIND_MIGRATE: hwloc_membind_flags_t = 1 << 3;
pub const HWLOC_MEMBIND_NOCPUBIND: hwloc_membind_flags_t = 1 << 4;
pub const HWLOC_MEMBIND_BYNODESET: hwloc_membind_flags_t = 1 << 5;
pub type hwloc_membind_policy_t = c_int;
pub const HWLOC_MEMBIND_DEFAULT: hwloc_membind_policy_t = 0;
pub const HWLOC_MEMBIND_FIRSTTOUCH: hwloc_membind_policy_t = 1;
pub const HWLOC_MEMBIND_BIND: hwloc_membind_policy_t = 2;
pub const HWLOC_MEMBIND_INTERLEAVE: hwloc_membind_policy_t = 3;
#[cfg(feature = "hwloc-2_11_0")]
pub const HWLOC_MEMBIND_WEIGHTED_INTERLEAVE: hwloc_membind_policy_t = 5;
pub const HWLOC_MEMBIND_NEXTTOUCH: hwloc_membind_policy_t = 4;
pub const HWLOC_MEMBIND_MIXED: hwloc_membind_policy_t = -1;
#[cfg(feature = "hwloc-2_1_0")]
pub type hwloc_topology_components_flag_e = c_ulong;
#[cfg(feature = "hwloc-2_1_0")]
pub const HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST: hwloc_topology_components_flag_e = 1 << 0;
pub type hwloc_topology_flags_e = c_ulong;
#[cfg_attr(
feature = "hwloc-2_1_0",
doc = "What additional objects could be detected with this flag depends on"
)]
#[cfg_attr(
feature = "hwloc-2_1_0",
doc = "[`hwloc_topology_discovery_support::disallowed_pu`] and"
)]
#[cfg_attr(
feature = "hwloc-2_1_0",
doc = "[`hwloc_topology_discovery_support::disallowed_numa`], which can be checked"
)]
#[cfg_attr(feature = "hwloc-2_1_0", doc = "after building the topology.")]
#[doc(alias = "HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM")]
pub const HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED: hwloc_topology_flags_e = 1 << 0;
pub const HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM: hwloc_topology_flags_e = 1 << 1;
pub const HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES: hwloc_topology_flags_e = 1 << 2;
#[cfg(feature = "hwloc-2_3_0")]
pub const HWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT: hwloc_topology_flags_e = 1 << 3;
#[cfg(feature = "hwloc-2_5_0")]
pub const HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING: hwloc_topology_flags_e = 1 << 4;
#[cfg(feature = "hwloc-2_5_0")]
pub const HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING: hwloc_topology_flags_e = 1 << 5;
#[cfg(feature = "hwloc-2_5_0")]
pub const HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING: hwloc_topology_flags_e = 1 << 6;
#[cfg(feature = "hwloc-2_8_0")]
pub const HWLOC_TOPOLOGY_FLAG_NO_DISTANCES: hwloc_topology_flags_e = 1 << 7;
#[cfg(feature = "hwloc-2_8_0")]
pub const HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS: hwloc_topology_flags_e = 1 << 8;
#[cfg(feature = "hwloc-2_8_0")]
pub const HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS: hwloc_topology_flags_e = 1 << 9;
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct hwloc_topology_support {
pub discovery: *const hwloc_topology_discovery_support,
pub cpubind: *const hwloc_topology_cpubind_support,
pub membind: *const hwloc_topology_membind_support,
#[cfg(feature = "hwloc-2_3_0")]
pub misc: *const hwloc_topology_misc_support,
}
impl Default for hwloc_topology_support {
fn default() -> Self {
Self {
discovery: ptr::null(),
cpubind: ptr::null(),
membind: ptr::null(),
#[cfg(feature = "hwloc-2_3_0")]
misc: ptr::null(),
}
}
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[repr(C)]
pub struct hwloc_topology_discovery_support {
pub pu: c_uchar,
pub numa: c_uchar,
pub numa_memory: c_uchar,
#[cfg(feature = "hwloc-2_1_0")]
pub disallowed_pu: c_uchar,
#[cfg(feature = "hwloc-2_1_0")]
pub disallowed_numa: c_uchar,
#[cfg(feature = "hwloc-2_4_0")]
pub cpukind_efficiency: c_uchar,
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[repr(C)]
pub struct hwloc_topology_cpubind_support {
pub set_thisproc_cpubind: c_uchar,
pub get_thisproc_cpubind: c_uchar,
pub set_proc_cpubind: c_uchar,
pub get_proc_cpubind: c_uchar,
pub set_thisthread_cpubind: c_uchar,
pub get_thisthread_cpubind: c_uchar,
pub set_thread_cpubind: c_uchar,
pub get_thread_cpubind: c_uchar,
pub get_thisproc_last_cpu_location: c_uchar,
pub get_proc_last_cpu_location: c_uchar,
pub get_thisthread_last_cpu_location: c_uchar,
}
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[repr(C)]
pub struct hwloc_topology_membind_support {
pub set_thisproc_membind: c_uchar,
pub get_thisproc_membind: c_uchar,
pub set_proc_membind: c_uchar,
pub get_proc_membind: c_uchar,
pub set_thisthread_membind: c_uchar,
pub get_thisthread_membind: c_uchar,
pub set_area_membind: c_uchar,
pub get_area_membind: c_uchar,
pub alloc_membind: c_uchar,
pub firsttouch_membind: c_uchar,
pub bind_membind: c_uchar,
pub interleave_membind: c_uchar,
pub nexttouch_membind: c_uchar,
pub migrate_membind: c_uchar,
pub get_area_memlocation: c_uchar,
#[cfg(feature = "hwloc-2_11_0")]
pub weighted_interleave_membind: c_uchar,
}
#[cfg(feature = "hwloc-2_3_0")]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
#[repr(C)]
pub struct hwloc_topology_misc_support {
pub imported_support: c_uchar,
}
pub type hwloc_type_filter_e = c_int;
pub const HWLOC_TYPE_FILTER_KEEP_ALL: hwloc_type_filter_e = 0;
pub const HWLOC_TYPE_FILTER_KEEP_NONE: hwloc_type_filter_e = 1;
pub const HWLOC_TYPE_FILTER_KEEP_STRUCTURE: hwloc_type_filter_e = 2;
pub const HWLOC_TYPE_FILTER_KEEP_IMPORTANT: hwloc_type_filter_e = 3;
#[allow(clippy::wildcard_imports)]
#[cfg(feature = "hwloc-2_3_0")]
mod topology_editing {
use super::*;
pub type hwloc_restrict_flags_e = c_ulong;
pub const HWLOC_RESTRICT_FLAG_REMOVE_CPULESS: hwloc_restrict_flags_e = 1 << 0;
pub const HWLOC_RESTRICT_FLAG_BYNODESET: hwloc_restrict_flags_e = 1 << 3;
pub const HWLOC_RESTRICT_FLAG_REMOVE_MEMLESS: hwloc_restrict_flags_e = 1 << 4;
pub const HWLOC_RESTRICT_FLAG_ADAPT_MISC: hwloc_restrict_flags_e = 1 << 1;
pub const HWLOC_RESTRICT_FLAG_ADAPT_IO: hwloc_restrict_flags_e = 1 << 2;
pub type hwloc_allow_flags_e = c_ulong;
pub const HWLOC_ALLOW_FLAG_ALL: hwloc_allow_flags_e = 1 << 0;
pub const HWLOC_ALLOW_FLAG_LOCAL_RESTRICTIONS: hwloc_allow_flags_e = 1 << 1;
pub const HWLOC_ALLOW_FLAG_CUSTOM: hwloc_allow_flags_e = 1 << 2;
}
#[cfg(feature = "hwloc-2_3_0")]
pub use topology_editing::*;
pub type hwloc_distrib_flags_e = c_ulong;
pub const HWLOC_DISTRIB_FLAG_REVERSE: hwloc_distrib_flags_e = 1 << 0;
#[allow(missing_debug_implementations)]
#[repr(C)]
pub struct hwloc_bitmap_s(IncompleteType);
impl RefUnwindSafe for hwloc_bitmap_s {}
pub type hwloc_bitmap_t = *mut hwloc_bitmap_s;
pub type hwloc_const_bitmap_t = *const hwloc_bitmap_s;
pub type hwloc_topology_export_xml_flags_e = c_ulong;
pub const HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1: hwloc_topology_export_xml_flags_e = 1 << 0;
pub type hwloc_topology_export_synthetic_flags_e = c_ulong;
pub const HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES:
hwloc_topology_export_synthetic_flags_e = 1 << 0;
pub const HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS: hwloc_topology_export_synthetic_flags_e =
1 << 1;
pub const HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1: hwloc_topology_export_synthetic_flags_e = 1 << 2;
pub const HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY:
hwloc_topology_export_synthetic_flags_e = 1 << 3;
pub type hwloc_distances_kind_e = c_ulong;
pub const HWLOC_DISTANCES_KIND_FROM_OS: hwloc_distances_kind_e = 1 << 0;
pub const HWLOC_DISTANCES_KIND_FROM_USER: hwloc_distances_kind_e = 1 << 1;
pub const HWLOC_DISTANCES_KIND_MEANS_LATENCY: hwloc_distances_kind_e = 1 << 2;
pub const HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH: hwloc_distances_kind_e = 1 << 3;
#[cfg(feature = "hwloc-2_1_0")]
pub const HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES: hwloc_distances_kind_e = 1 << 4;
#[allow(clippy::wildcard_imports)]
#[cfg(feature = "hwloc-2_5_0")]
mod distances_transform {
use super::*;
pub type hwloc_distances_transform_e = c_uint;
pub const HWLOC_DISTANCES_TRANSFORM_REMOVE_NULL: hwloc_distances_transform_e = 0;
pub const HWLOC_DISTANCES_TRANSFORM_LINKS: hwloc_distances_transform_e = 1;
pub const HWLOC_DISTANCES_TRANSFORM_MERGE_SWITCH_PORTS: hwloc_distances_transform_e = 2;
pub const HWLOC_DISTANCES_TRANSFORM_TRANSITIVE_CLOSURE: hwloc_distances_transform_e = 3;
}
#[cfg(feature = "hwloc-2_5_0")]
pub use distances_transform::*;
#[cfg_attr(
feature = "hwloc-2_5_0",
doc = "For instance, on hwloc 2.5+, if there is a single NUMA node per Package,"
)]
#[cfg_attr(
feature = "hwloc-2_5_0",
doc = "[`hwloc_get_obj_with_same_locality()`] may be used to convert"
)]
#[cfg_attr(
feature = "hwloc-2_5_0",
doc = "between them and replace NUMA nodes in the objs array with the corresponding"
)]
#[cfg_attr(feature = "hwloc-2_5_0", doc = "Packages.")]
#[cfg_attr(feature = "hwloc-2_5_0", doc = "")]
#[cfg_attr(
feature = "hwloc-2_5_0",
doc = "See also [`hwloc_distances_transform()`] for applying some"
)]
#[cfg_attr(feature = "hwloc-2_5_0", doc = "transformations to the structure.")]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct hwloc_distances_s {
pub nbobj: c_uint,
pub objs: *mut hwloc_obj_t,
pub kind: c_ulong,
pub values: *mut u64,
}
impl Default for hwloc_distances_s {
fn default() -> Self {
Self {
nbobj: 0,
objs: ptr::null_mut(),
kind: 0,
values: ptr::null_mut(),
}
}
}
#[cfg(feature = "hwloc-2_5_0")]
pub type hwloc_distances_add_handle_t = *mut c_void;
#[cfg(feature = "hwloc-2_5_0")]
pub type hwloc_distances_add_flag_e = c_ulong;
#[cfg(feature = "hwloc-2_5_0")]
pub const HWLOC_DISTANCES_ADD_FLAG_GROUP: hwloc_distances_add_flag_e = 1 << 0;
#[cfg(feature = "hwloc-2_5_0")]
pub const HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE: hwloc_distances_add_flag_e = 1 << 1;
#[allow(clippy::wildcard_imports)]
#[cfg(feature = "hwloc-2_3_0")]
mod memory_attributes {
use super::*;
#[doc(alias = "hwloc_memattr_id_e")]
pub type hwloc_memattr_id_t = c_uint;
pub const HWLOC_MEMATTR_ID_CAPACITY: hwloc_memattr_id_t = 0;
pub const HWLOC_MEMATTR_ID_LOCALITY: hwloc_memattr_id_t = 1;
pub const HWLOC_MEMATTR_ID_BANDWIDTH: hwloc_memattr_id_t = 2;
#[cfg(feature = "hwloc-2_8_0")]
#[cfg_attr(docsrs, doc(cfg(feature = "hwloc-2_8_0")))]
pub const HWLOC_MEMATTR_ID_READ_BANDWIDTH: hwloc_memattr_id_t = 4;
#[cfg(feature = "hwloc-2_8_0")]
#[cfg_attr(docsrs, doc(cfg(feature = "hwloc-2_8_0")))]
pub const HWLOC_MEMATTR_ID_WRITE_BANDWIDTH: hwloc_memattr_id_t = 5;
pub const HWLOC_MEMATTR_ID_LATENCY: hwloc_memattr_id_t = 3;
#[cfg(feature = "hwloc-2_8_0")]
#[cfg_attr(docsrs, doc(cfg(feature = "hwloc-2_8_0")))]
pub const HWLOC_MEMATTR_ID_READ_LATENCY: hwloc_memattr_id_t = 6;
#[cfg(feature = "hwloc-2_8_0")]
#[cfg_attr(docsrs, doc(cfg(feature = "hwloc-2_8_0")))]
pub const HWLOC_MEMATTR_ID_WRITE_LATENCY: hwloc_memattr_id_t = 7;
pub type hwloc_local_numanode_flag_e = c_ulong;
pub const HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY: hwloc_local_numanode_flag_e = 1 << 0;
pub const HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY: hwloc_local_numanode_flag_e = 1 << 1;
#[cfg(feature = "hwloc-2_12_1")]
pub const HWLOC_LOCAL_NUMANODE_FLAG_INTERSECT_LOCALITY: hwloc_local_numanode_flag_e = 1 << 3;
pub const HWLOC_LOCAL_NUMANODE_FLAG_ALL: hwloc_local_numanode_flag_e = 1 << 2;
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct hwloc_location {
#[doc(alias = "hwloc_location::type")]
pub ty: hwloc_location_type_e,
pub location: hwloc_location_u,
}
pub type hwloc_location_type_e = c_int;
pub const HWLOC_LOCATION_TYPE_CPUSET: hwloc_location_type_e = 1;
pub const HWLOC_LOCATION_TYPE_OBJECT: hwloc_location_type_e = 0;
#[derive(Copy, Clone)]
#[doc(alias = "hwloc_location::hwloc_location_u")]
#[repr(C)]
pub union hwloc_location_u {
pub cpuset: hwloc_const_cpuset_t,
pub object: *const hwloc_obj,
}
impl Debug for hwloc_location_u {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("hwloc_location_u").finish_non_exhaustive()
}
}
pub type hwloc_memattr_flag_e = c_ulong;
pub const HWLOC_MEMATTR_FLAG_HIGHER_FIRST: hwloc_memattr_flag_e = 1 << 0;
pub const HWLOC_MEMATTR_FLAG_LOWER_FIRST: hwloc_memattr_flag_e = 1 << 1;
pub const HWLOC_MEMATTR_FLAG_NEED_INITIATOR: hwloc_memattr_flag_e = 1 << 2;
}
#[cfg(feature = "hwloc-2_3_0")]
pub use memory_attributes::*;
macro_rules! extern_c_block {
($link_name:literal) => {
#[link(name = $link_name)]
unsafe extern "C" {
#[must_use]
pub fn hwloc_get_api_version() -> c_uint;
#[must_use]
pub fn hwloc_compare_types(type1: hwloc_obj_type_t, type2: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_topology_init(topology: *mut hwloc_topology_t) -> c_int;
#[must_use]
pub fn hwloc_topology_load(topology: hwloc_topology_t) -> c_int;
pub fn hwloc_topology_destroy(topology: hwloc_topology_t);
#[must_use]
pub fn hwloc_topology_dup(
newtop: *mut hwloc_topology_t,
oldtop: hwloc_const_topology_t,
) -> c_int;
#[must_use]
pub fn hwloc_topology_abi_check(topology: hwloc_const_topology_t) -> c_int;
pub fn hwloc_topology_check(topology: hwloc_const_topology_t);
#[must_use]
pub fn hwloc_topology_get_depth(
topology: hwloc_const_topology_t,
) -> hwloc_get_type_depth_e;
#[must_use]
pub fn hwloc_get_type_depth(
topology: hwloc_const_topology_t,
object_type: hwloc_obj_type_t,
) -> hwloc_get_type_depth_e;
#[must_use]
pub fn hwloc_get_memory_parents_depth(
topology: hwloc_const_topology_t,
) -> hwloc_get_type_depth_e;
#[must_use]
pub fn hwloc_get_depth_type(
topology: hwloc_const_topology_t,
depth: hwloc_get_type_depth_e,
) -> hwloc_obj_type_t;
#[must_use]
pub fn hwloc_get_nbobjs_by_depth(
topology: hwloc_const_topology_t,
depth: hwloc_get_type_depth_e,
) -> c_uint;
#[must_use]
pub fn hwloc_get_obj_by_depth(
topology: hwloc_const_topology_t,
depth: hwloc_get_type_depth_e,
idx: c_uint,
) -> hwloc_obj_t;
#[must_use]
pub fn hwloc_obj_type_snprintf(
into: *mut c_char,
size: usize,
object: *const hwloc_obj,
verbose: c_int,
) -> c_int;
#[must_use]
pub fn hwloc_obj_attr_snprintf(
into: *mut c_char,
size: usize,
object: *const hwloc_obj,
separator: *const c_char,
verbose: c_int,
) -> c_int;
#[must_use]
pub fn hwloc_obj_add_info(
obj: hwloc_obj_t,
name: *const c_char,
value: *const c_char,
) -> c_int;
#[cfg(feature = "hwloc-2_11_0")]
#[must_use]
pub fn hwloc_obj_set_subtype(
topology: hwloc_topology_t,
obj: hwloc_obj_t,
subtype: *const c_char,
) -> c_int;
#[must_use]
pub fn hwloc_set_cpubind(
topology: hwloc_const_topology_t,
set: hwloc_const_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_cpubind(
topology: hwloc_const_topology_t,
set: hwloc_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_set_proc_cpubind(
topology: hwloc_const_topology_t,
pid: hwloc_pid_t,
set: hwloc_const_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_proc_cpubind(
topology: hwloc_const_topology_t,
pid: hwloc_pid_t,
set: hwloc_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_set_thread_cpubind(
topology: hwloc_const_topology_t,
thread: hwloc_thread_t,
set: hwloc_const_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_thread_cpubind(
topology: hwloc_const_topology_t,
pid: hwloc_thread_t,
set: hwloc_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_last_cpu_location(
topology: hwloc_const_topology_t,
set: hwloc_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_proc_last_cpu_location(
topology: hwloc_const_topology_t,
pid: hwloc_pid_t,
set: hwloc_cpuset_t,
flags: hwloc_cpubind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_set_membind(
topology: hwloc_const_topology_t,
set: hwloc_const_bitmap_t,
policy: hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_membind(
topology: hwloc_const_topology_t,
set: hwloc_bitmap_t,
policy: *mut hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_set_proc_membind(
topology: hwloc_const_topology_t,
pid: hwloc_pid_t,
set: hwloc_const_bitmap_t,
policy: hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_proc_membind(
topology: hwloc_const_topology_t,
pid: hwloc_pid_t,
set: hwloc_bitmap_t,
policy: *mut hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_set_area_membind(
topology: hwloc_const_topology_t,
addr: *const c_void,
len: usize,
set: hwloc_const_bitmap_t,
policy: hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_area_membind(
topology: hwloc_const_topology_t,
addr: *const c_void,
len: usize,
set: hwloc_bitmap_t,
policy: *mut hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_get_area_memlocation(
topology: hwloc_const_topology_t,
addr: *const c_void,
len: usize,
set: hwloc_bitmap_t,
flags: hwloc_membind_flags_t,
) -> c_int;
#[must_use]
pub fn hwloc_alloc(topology: hwloc_const_topology_t, len: usize) -> *mut c_void;
#[must_use]
pub fn hwloc_alloc_membind(
topology: hwloc_const_topology_t,
len: usize,
set: hwloc_const_bitmap_t,
policy: hwloc_membind_policy_t,
flags: hwloc_membind_flags_t,
) -> *mut c_void;
#[must_use]
pub fn hwloc_free(
topology: hwloc_const_topology_t,
addr: *mut c_void,
len: usize,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_pid(topology: hwloc_topology_t, pid: hwloc_pid_t) -> c_int;
#[must_use]
pub fn hwloc_topology_set_synthetic(
topology: hwloc_topology_t,
description: *const c_char,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_xml(
topology: hwloc_topology_t,
xmlpath: *const c_char,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_xmlbuffer(
topology: hwloc_topology_t,
buffer: *const c_char,
size: c_int,
) -> c_int;
#[cfg(feature = "hwloc-2_1_0")]
#[must_use]
pub fn hwloc_topology_set_components(
topology: hwloc_topology_t,
flags: hwloc_topology_components_flag_e,
name: *const c_char,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_flags(
topology: hwloc_topology_t,
flags: hwloc_topology_flags_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_get_flags(
topology: hwloc_const_topology_t,
) -> hwloc_topology_flags_e;
#[must_use]
pub fn hwloc_topology_is_thissystem(topology: hwloc_const_topology_t) -> c_int;
#[must_use]
pub fn hwloc_topology_get_support(
topology: hwloc_const_topology_t,
) -> *const hwloc_topology_support;
#[must_use]
pub fn hwloc_topology_set_type_filter(
topology: hwloc_topology_t,
ty: hwloc_obj_type_t,
filter: hwloc_type_filter_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_get_type_filter(
topology: hwloc_const_topology_t,
ty: hwloc_obj_type_t,
filter: *mut hwloc_type_filter_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_all_types_filter(
topology: hwloc_topology_t,
filter: hwloc_type_filter_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_cache_types_filter(
topology: hwloc_topology_t,
filter: hwloc_type_filter_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_icache_types_filter(
topology: hwloc_topology_t,
filter: hwloc_type_filter_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_set_io_types_filter(
topology: hwloc_topology_t,
filter: hwloc_type_filter_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_restrict(
topology: hwloc_topology_t,
set: hwloc_const_bitmap_t,
flags: hwloc_restrict_flags_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_allow(
topology: hwloc_topology_t,
cpuset: hwloc_const_cpuset_t,
nodeset: hwloc_const_nodeset_t,
flags: hwloc_allow_flags_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_insert_misc_object(
topology: hwloc_topology_t,
parent: hwloc_obj_t,
name: *const c_char,
) -> hwloc_obj_t;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_alloc_group_object(topology: hwloc_topology_t) -> hwloc_obj_t;
#[cfg(feature = "hwloc-2_10_0")]
#[must_use]
pub fn hwloc_topology_free_group_object(
topology: hwloc_topology_t,
group: hwloc_obj_t,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_insert_group_object(
topology: hwloc_topology_t,
group: hwloc_obj_t,
) -> hwloc_obj_t;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_obj_add_other_obj_sets(dst: hwloc_obj_t, src: *const hwloc_obj) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_topology_refresh(topology: hwloc_topology_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_normal(ty: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_io(ty: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_memory(ty: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_cache(ty: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_dcache(ty: hwloc_obj_type_t) -> c_int;
#[must_use]
pub fn hwloc_obj_type_is_icache(ty: hwloc_obj_type_t) -> c_int;
#[cfg(feature = "hwloc-2_2_0")]
#[must_use]
pub fn hwloc_bitmap_singlify_per_core(
topology: hwloc_const_topology_t,
cpuset: hwloc_cpuset_t,
which: c_uint,
) -> c_int;
#[cfg(feature = "hwloc-2_5_0")]
#[must_use]
pub fn hwloc_get_obj_with_same_locality(
topology: hwloc_const_topology_t,
src: *const hwloc_obj,
ty: hwloc_obj_type_t,
subtype: *const c_char,
nameprefix: *const c_char,
flags: c_ulong,
) -> *const hwloc_obj;
#[must_use]
pub fn hwloc_topology_get_complete_cpuset(
topology: hwloc_const_topology_t,
) -> hwloc_const_cpuset_t;
#[must_use]
pub fn hwloc_topology_get_topology_cpuset(
topology: hwloc_const_topology_t,
) -> hwloc_const_cpuset_t;
#[must_use]
pub fn hwloc_topology_get_allowed_cpuset(
topology: hwloc_const_topology_t,
) -> hwloc_const_cpuset_t;
#[must_use]
pub fn hwloc_topology_get_complete_nodeset(
topology: hwloc_const_topology_t,
) -> hwloc_const_nodeset_t;
#[must_use]
pub fn hwloc_topology_get_topology_nodeset(
topology: hwloc_const_topology_t,
) -> hwloc_const_nodeset_t;
#[must_use]
pub fn hwloc_topology_get_allowed_nodeset(
topology: hwloc_const_topology_t,
) -> hwloc_const_nodeset_t;
#[must_use]
pub fn hwloc_bitmap_alloc() -> hwloc_bitmap_t;
#[must_use]
pub fn hwloc_bitmap_alloc_full() -> hwloc_bitmap_t;
pub fn hwloc_bitmap_free(bitmap: hwloc_bitmap_t);
#[must_use]
pub fn hwloc_bitmap_dup(src: hwloc_const_bitmap_t) -> hwloc_bitmap_t;
#[must_use]
pub fn hwloc_bitmap_copy(dst: hwloc_bitmap_t, src: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_list_snprintf(
buf: *mut c_char,
len: usize,
bitmap: hwloc_const_bitmap_t,
) -> c_int;
pub fn hwloc_bitmap_zero(bitmap: hwloc_bitmap_t);
pub fn hwloc_bitmap_fill(bitmap: hwloc_bitmap_t);
#[must_use]
pub fn hwloc_bitmap_only(bitmap: hwloc_bitmap_t, id: c_uint) -> c_int;
#[must_use]
pub fn hwloc_bitmap_allbut(bitmap: hwloc_bitmap_t, id: c_uint) -> c_int;
#[must_use]
pub fn hwloc_bitmap_set(bitmap: hwloc_bitmap_t, id: c_uint) -> c_int;
#[must_use]
pub fn hwloc_bitmap_set_range(
bitmap: hwloc_bitmap_t,
begin: c_uint,
end: c_int,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_clr(bitmap: hwloc_bitmap_t, id: c_uint) -> c_int;
#[must_use]
pub fn hwloc_bitmap_clr_range(
bitmap: hwloc_bitmap_t,
begin: c_uint,
end: c_int,
) -> c_int;
pub fn hwloc_bitmap_singlify(bitmap: hwloc_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_isset(bitmap: hwloc_const_bitmap_t, id: c_uint) -> c_int;
#[must_use]
pub fn hwloc_bitmap_iszero(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_isfull(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_first(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_next(bitmap: hwloc_const_bitmap_t, prev: c_int) -> c_int;
#[must_use]
pub fn hwloc_bitmap_last(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_weight(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_first_unset(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_next_unset(bitmap: hwloc_const_bitmap_t, prev: c_int) -> c_int;
#[must_use]
pub fn hwloc_bitmap_last_unset(bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_or(
result: hwloc_bitmap_t,
bitmap1: hwloc_const_bitmap_t,
bitmap2: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_and(
result: hwloc_bitmap_t,
bitmap1: hwloc_const_bitmap_t,
bitmap2: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_andnot(
result: hwloc_bitmap_t,
bitmap1: hwloc_const_bitmap_t,
bitmap2: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_xor(
result: hwloc_bitmap_t,
bitmap1: hwloc_const_bitmap_t,
bitmap2: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_not(result: hwloc_bitmap_t, bitmap: hwloc_const_bitmap_t) -> c_int;
#[must_use]
pub fn hwloc_bitmap_intersects(
left: hwloc_const_bitmap_t,
right: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_isincluded(
left: hwloc_const_bitmap_t,
right: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_isequal(
left: hwloc_const_bitmap_t,
right: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_bitmap_compare(
left: hwloc_const_bitmap_t,
right: hwloc_const_bitmap_t,
) -> c_int;
#[must_use]
pub fn hwloc_topology_export_xml(
topology: hwloc_const_topology_t,
xmlpath: *const c_char,
flags: hwloc_topology_export_xml_flags_e,
) -> c_int;
#[must_use]
pub fn hwloc_topology_export_xmlbuffer(
topology: hwloc_const_topology_t,
xmlbuffer: *mut *mut c_char,
buflen: *mut c_int,
flags: hwloc_topology_export_xml_flags_e,
) -> c_int;
pub fn hwloc_free_xmlbuffer(topology: hwloc_const_topology_t, xmlbuffer: *mut c_char);
#[must_use]
pub fn hwloc_topology_export_synthetic(
topology: hwloc_const_topology_t,
buffer: *mut c_char,
buflen: usize,
flags: hwloc_topology_export_synthetic_flags_e,
) -> c_int;
#[must_use]
pub fn hwloc_distances_get(
topology: hwloc_const_topology_t,
nr: *mut c_uint,
distances: *mut *mut hwloc_distances_s,
kind: hwloc_distances_kind_e,
flags: c_ulong,
) -> c_int;
#[must_use]
pub fn hwloc_distances_get_by_depth(
topology: hwloc_const_topology_t,
depth: c_int,
nr: *mut c_uint,
distances: *mut *mut hwloc_distances_s,
kind: hwloc_distances_kind_e,
flags: c_ulong,
) -> c_int;
#[must_use]
pub fn hwloc_distances_get_by_type(
topology: hwloc_const_topology_t,
ty: hwloc_obj_type_t,
nr: *mut c_uint,
distances: *mut *mut hwloc_distances_s,
kind: hwloc_distances_kind_e,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_1_0")]
#[must_use]
pub fn hwloc_distances_get_by_name(
topology: hwloc_const_topology_t,
name: *const c_char,
nr: *mut c_uint,
distances: *mut *mut hwloc_distances_s,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_1_0")]
#[must_use]
pub fn hwloc_distances_get_name(
topology: hwloc_const_topology_t,
distances: *const hwloc_distances_s,
) -> *const c_char;
pub fn hwloc_distances_release(
topology: hwloc_const_topology_t,
distances: *const hwloc_distances_s,
);
#[cfg(feature = "hwloc-2_5_0")]
#[must_use]
pub fn hwloc_distances_transform(
topology: hwloc_const_topology_t,
distances: *mut hwloc_distances_s,
transform: hwloc_distances_transform_e,
transform_attr: *mut c_void,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_5_0")]
#[must_use]
pub fn hwloc_distances_add_create(
topology: hwloc_topology_t,
name: *const c_char,
kind: hwloc_distances_kind_e,
flags: c_ulong,
) -> hwloc_distances_add_handle_t;
#[cfg(feature = "hwloc-2_5_0")]
#[must_use]
pub fn hwloc_distances_add_values(
topology: hwloc_topology_t,
handle: hwloc_distances_add_handle_t,
nbobjs: c_uint,
objs: *const *const hwloc_obj,
values: *const u64,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_5_0")]
#[must_use]
pub fn hwloc_distances_add_commit(
topology: hwloc_topology_t,
handle: hwloc_distances_add_handle_t,
flags: hwloc_distances_add_flag_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_distances_remove(topology: hwloc_topology_t) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_distances_remove_by_depth(
topology: hwloc_topology_t,
depth: hwloc_get_type_depth_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_distances_release_remove(
topology: hwloc_topology_t,
distances: *mut hwloc_distances_s,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_by_name(
topology: hwloc_const_topology_t,
name: *const c_char,
id: *mut hwloc_memattr_id_t,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_get_local_numanode_objs(
topology: hwloc_const_topology_t,
location: *const hwloc_location,
nr: *mut c_uint,
nodes: *mut *const hwloc_obj,
flags: hwloc_local_numanode_flag_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_value(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
target_node: *const hwloc_obj,
initiator: *const hwloc_location,
flags: c_ulong,
value: *mut u64,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_best_target(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
initiator: *const hwloc_location,
flags: c_ulong,
best_target: *mut *const hwloc_obj,
value: *mut u64,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_best_initiator(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
target: *const hwloc_obj,
flags: c_ulong,
best_initiator: *mut hwloc_location,
value: *mut u64,
) -> c_int;
#[cfg(feature = "hwloc-2_12_0")]
pub fn hwloc_topology_get_default_nodeset(
topology: hwloc_const_topology_t,
nodeset: hwloc_nodeset_t,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_name(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
name: *mut *const c_char,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_flags(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
flags: *mut hwloc_memattr_flag_e,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_register(
topology: hwloc_topology_t,
name: *const c_char,
flags: hwloc_memattr_flag_e,
id: *mut hwloc_memattr_id_t,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_set_value(
topology: hwloc_topology_t,
attribute: hwloc_memattr_id_t,
target_node: *const hwloc_obj,
initiator: *const hwloc_location,
flags: c_ulong,
value: u64,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_targets(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
initiator: *const hwloc_location,
flags: c_ulong,
nr: *mut c_uint,
targets: *mut *const hwloc_obj,
values: *mut u64,
) -> c_int;
#[cfg(feature = "hwloc-2_3_0")]
#[must_use]
pub fn hwloc_memattr_get_initiators(
topology: hwloc_const_topology_t,
attribute: hwloc_memattr_id_t,
target_node: *const hwloc_obj,
flags: c_ulong,
nr: *mut c_uint,
initiators: *mut hwloc_location,
values: *mut u64,
) -> c_int;
#[cfg(feature = "hwloc-2_4_0")]
#[must_use]
pub fn hwloc_cpukinds_get_nr(topology: hwloc_const_topology_t, flags: c_ulong)
-> c_int;
#[cfg(feature = "hwloc-2_4_0")]
#[must_use]
pub fn hwloc_cpukinds_get_by_cpuset(
topology: hwloc_const_topology_t,
cpuset: hwloc_const_cpuset_t,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_4_0")]
#[must_use]
pub fn hwloc_cpukinds_get_info(
topology: hwloc_const_topology_t,
kind_index: c_uint,
cpuset: hwloc_cpuset_t,
efficiency: *mut c_int,
nr_infos: *mut c_uint,
infos: *mut *mut hwloc_info_s,
flags: c_ulong,
) -> c_int;
#[cfg(feature = "hwloc-2_4_0")]
#[must_use]
pub fn hwloc_cpukinds_register(
topology: hwloc_topology_t,
cpuset: hwloc_const_cpuset_t,
forced_efficiency: c_int,
nr_infos: c_uint,
infos: *const hwloc_info_s,
flags: c_ulong,
) -> c_int;
#[cfg(any(doc, target_os = "linux"))]
#[must_use]
pub fn hwloc_linux_set_tid_cpubind(
topology: hwloc_const_topology_t,
tid: pid_t,
set: hwloc_const_cpuset_t,
) -> c_int;
#[cfg(any(doc, target_os = "linux"))]
#[must_use]
pub fn hwloc_linux_get_tid_cpubind(
topology: hwloc_const_topology_t,
tid: pid_t,
set: hwloc_cpuset_t,
) -> c_int;
#[cfg(any(doc, target_os = "linux"))]
#[must_use]
pub fn hwloc_linux_get_tid_last_cpu_location(
topology: hwloc_const_topology_t,
tid: pid_t,
set: hwloc_cpuset_t,
) -> c_int;
#[cfg(any(doc, target_os = "linux"))]
#[must_use]
pub fn hwloc_linux_read_path_as_cpumask(
path: *const c_char,
set: hwloc_cpuset_t,
) -> c_int;
#[cfg(any(doc, all(feature = "hwloc-2_5_0", target_os = "windows")))]
#[must_use]
pub fn hwloc_windows_get_nr_processor_groups(
topology: hwloc_const_topology_t,
flags: c_ulong,
) -> c_int;
#[cfg(any(doc, all(feature = "hwloc-2_5_0", target_os = "windows")))]
#[must_use]
pub fn hwloc_windows_get_processor_group_cpuset(
topology: hwloc_const_topology_t,
pg_index: c_uint,
cpuset: hwloc_cpuset_t,
flags: c_ulong,
) -> c_int;
}
};
}
#[cfg(all(not(feature = "vendored"), target_os = "windows"))]
extern_c_block!("libhwloc");
#[cfg(all(feature = "vendored", target_os = "windows"))]
extern_c_block!("hwloc");
#[cfg(not(target_os = "windows"))]
extern_c_block!("hwloc");
#[cfg(test)]
mod tests {
use super::*;
use static_assertions::{assert_impl_all, assert_not_impl_any};
use std::{
fmt::{self, Binary, Display, LowerExp, LowerHex, Octal, Pointer, UpperExp, UpperHex},
hash::Hash,
io::{self, Read},
ops::Deref,
panic::UnwindSafe,
};
assert_impl_all!(IncompleteType: Sized);
assert_not_impl_any!(IncompleteType:
Binary, Clone, Debug, Default, Deref, Display, Drop, IntoIterator,
LowerExp, LowerHex, Octal, PartialEq, Pointer, Read, Send, ToOwned,
Unpin, RefUnwindSafe, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_bitmap_s: Sized, RefUnwindSafe);
assert_not_impl_any!(hwloc_bitmap_s:
Binary, Clone, Debug, Default, Deref, Display, Drop, IntoIterator,
LowerExp, LowerHex, Octal, PartialEq, Pointer, Read, Send, ToOwned,
Unpin, UnwindSafe, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_topology: Sized, RefUnwindSafe);
assert_not_impl_any!(hwloc_topology:
Binary, Clone, Debug, Default, Deref, Display, Drop, IntoIterator,
LowerExp, LowerHex, Octal, PartialEq, Pointer, Read, Send, ToOwned,
Unpin, UnwindSafe, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_info_s:
Copy, Debug, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_info_s:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
#[cfg(feature = "hwloc-2_3_0")]
mod hwloc_location_impls {
use super::*;
assert_impl_all!(hwloc_location:
Copy, Debug, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_location:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp,
LowerHex, Octal, PartialEq, Pointer, Read, Send, UpperExp, UpperHex,
fmt::Write, io::Write
);
assert_impl_all!(hwloc_location_u:
Copy, Debug, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_location_u:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp,
LowerHex, Octal, PartialEq, Pointer, Read, Send, UpperExp, UpperHex,
fmt::Write, io::Write
);
}
assert_impl_all!(hwloc_obj:
Copy, Debug, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_obj:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_distances_s:
Copy, Debug, Default, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_distances_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_numanode_attr_s:
Copy, Debug, Default, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_numanode_attr_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_topology_support:
Copy, Debug, Default, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_topology_support:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_obj_attr_u:
Copy, Debug, Sized, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_obj_attr_u:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, Send, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_bridge_attr_s:
Copy, Debug, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_bridge_attr_s:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(RawDownstreamAttributes:
Copy, Debug, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(RawDownstreamAttributes:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(RawUpstreamAttributes:
Copy, Debug, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(RawUpstreamAttributes:
Binary, Default, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex,
Octal, PartialEq, Pointer, Read, UpperExp, UpperHex, fmt::Write,
io::Write
);
assert_impl_all!(hwloc_cache_attr_s:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_cache_attr_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_group_attr_s:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_group_attr_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_osdev_attr_s:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_osdev_attr_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_topology_cpubind_support:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_topology_cpubind_support:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_topology_discovery_support:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_topology_discovery_support:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_topology_membind_support:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_topology_membind_support:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
#[cfg(feature = "hwloc-2_3_0")]
assert_impl_all!(hwloc_topology_misc_support:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
#[cfg(feature = "hwloc-2_3_0")]
assert_not_impl_any!(hwloc_topology_misc_support:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(RawDownstreamPCIAttributes:
Copy, Debug, Default, Hash, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(RawDownstreamPCIAttributes:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_memory_page_type_s:
Copy, Debug, Default, Hash, Ord, Sized, Sync, Unpin, UnwindSafe
);
assert_not_impl_any!(hwloc_memory_page_type_s:
Binary, Deref, Display, Drop, IntoIterator, LowerExp, LowerHex, Octal,
Pointer, Read, UpperExp, UpperHex, fmt::Write, io::Write
);
assert_impl_all!(hwloc_pcidev_attr_s:
Copy, Debug, Default, PartialEq, Sized, Sync, Unpin,
UnwindSafe
);
assert_not_impl_any!(hwloc_pcidev_attr_s:
Binary, Deref, Display, Drop, Eq, IntoIterator, LowerExp, LowerHex,
Octal, PartialOrd, Pointer, Read, UpperExp, UpperHex, fmt::Write,
io::Write
);
#[test]
fn hwloc_obj_attr_u() {
let attr = super::hwloc_obj_attr_u {
cache: hwloc_cache_attr_s::default(),
};
assert_eq!(format!("{attr:?}"), "hwloc_obj_attr_u { .. }");
}
#[test]
fn hwloc_numanode_attr_s() {
let hwloc_numanode_attr_s {
local_memory,
page_types_len,
page_types,
} = super::hwloc_numanode_attr_s::default();
assert_eq!(local_memory, 0);
assert_eq!(page_types_len, 0);
assert!(page_types.is_null());
}
#[test]
fn hwloc_bridge_attr_s() {
let attr = super::hwloc_bridge_attr_s {
upstream: RawUpstreamAttributes {
pci: hwloc_pcidev_attr_s::default(),
},
upstream_type: HWLOC_OBJ_BRIDGE_PCI,
downstream: RawDownstreamAttributes {
pci: RawDownstreamPCIAttributes::default(),
},
downstream_type: HWLOC_OBJ_BRIDGE_PCI,
depth: 42,
};
assert_eq!(
format!("{attr:?}"),
"hwloc_bridge_attr_s { upstream: RawUpstreamAttributes { .. }, \
upstream_type: 1, \
downstream: RawDownstreamAttributes { .. }, \
downstream_type: 1, \
depth: 42 }"
);
}
#[test]
fn hwloc_topology_support() {
let default = super::hwloc_topology_support::default();
#[cfg(not(feature = "hwloc-2_3_0"))]
let hwloc_topology_support {
discovery,
cpubind,
membind,
} = default;
#[cfg(feature = "hwloc-2_3_0")]
let hwloc_topology_support {
discovery,
cpubind,
membind,
misc,
} = default;
assert!(discovery.is_null());
assert!(cpubind.is_null());
assert!(membind.is_null());
#[cfg(feature = "hwloc-2_3_0")]
assert!(misc.is_null());
}
#[test]
fn hwloc_distances_s() {
let hwloc_distances_s {
nbobj,
objs,
kind,
values,
} = super::hwloc_distances_s::default();
assert_eq!(nbobj, 0);
assert!(objs.is_null());
assert_eq!(kind, 0);
assert!(values.is_null());
}
#[cfg(feature = "hwloc-2_3_0")]
#[test]
fn hwloc_location() {
let location = super::hwloc_location {
ty: HWLOC_LOCATION_TYPE_CPUSET,
location: hwloc_location_u {
cpuset: ptr::null(),
},
};
assert_eq!(
format!("{location:?}"),
"hwloc_location { ty: 1, \
location: hwloc_location_u { .. } }"
);
}
}