iceoryx2_bb_elementary/
lib.rs

1// Copyright (c) 2023 Contributors to the Eclipse Foundation
2//
3// See the NOTICE file(s) distributed with this work for additional
4// information regarding copyright ownership.
5//
6// This program and the accompanying materials are made available under the
7// terms of the Apache Software License 2.0 which is available at
8// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9// which is available at https://opensource.org/licenses/MIT.
10//
11// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13#![warn(clippy::alloc_instead_of_core)]
14#![warn(clippy::std_instead_of_alloc)]
15#![warn(clippy::std_instead_of_core)]
16
17//! Contains basic constructs which do not have any kind of dependency.
18
19#[macro_use]
20pub mod enum_gen;
21
22pub mod alignment;
23/// A strong type that represents the alignment part of [`core::alloc::Layout`]
24pub mod bump_allocator;
25pub mod cyclic_tagger;
26pub mod lazy_singleton;
27pub mod math;
28pub mod package_version;
29pub mod relocatable_ptr;
30pub mod scope_guard;
31pub mod static_assert;
32pub mod unique_id;
33pub mod unsendable_marker;
34
35/// Defines how a callback based iteration shall progress after the calling the callback. Either
36/// stop the iteration with [`CallbackProgression::Stop`] or continue with
37/// [`CallbackProgression::Continue`].
38///
39/// ```rust
40/// use iceoryx2_bb_elementary::CallbackProgression;
41///
42/// fn iterate_over_something<F: FnMut(usize) -> CallbackProgression>(mut callback: F) {
43///     for i in 0..123 {
44///         match callback(i) {
45///             CallbackProgression::Stop => break,
46///             CallbackProgression::Continue => continue
47///         }
48///     }
49/// }
50/// ```
51#[derive(Debug, PartialEq, Eq, Clone, Copy)]
52pub enum CallbackProgression {
53    /// Stops the iteration
54    Stop,
55    /// Continues the iteration
56    Continue,
57}