iceoryx2_pal_configuration/
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#![no_std]
14
15#[cfg(not(target_os = "windows"))]
16pub mod settings {
17    pub const TEMP_DIRECTORY: &[u8] = b"/tmp/";
18    pub const TEST_DIRECTORY: &[u8] = b"/tmp/iceoryx2/tests/";
19    pub const SHARED_MEMORY_DIRECTORY: &[u8] = b"/dev/shm/";
20    pub const PATH_SEPARATOR: u8 = b'/';
21    pub const ROOT: &[u8] = b"/";
22    pub const FILENAME_LENGTH: usize = 255;
23    // it is actually 4096 but to be more compatible with windows and also safe some stack the number
24    // is reduced to 255
25    pub const PATH_LENGTH: usize = 255;
26    #[cfg(not(target_os = "macos"))]
27    pub const AT_LEAST_TIMING_VARIANCE: f32 = 0.25;
28    #[cfg(target_os = "macos")]
29    pub const AT_LEAST_TIMING_VARIANCE: f32 = 1.0;
30}
31
32#[cfg(target_os = "windows")]
33pub mod settings {
34    pub const TEMP_DIRECTORY: &[u8] = b"C:\\Temp\\";
35    pub const TEST_DIRECTORY: &[u8] = b"C:\\Temp\\iceoryx2\\tests\\";
36    pub const SHARED_MEMORY_DIRECTORY: &[u8] = b"C:\\Temp\\iceoryx2\\shm\\";
37    pub const PATH_SEPARATOR: u8 = b'\\';
38    pub const ROOT: &[u8] = b"C:\\";
39    pub const FILENAME_LENGTH: usize = 255;
40    pub const PATH_LENGTH: usize = 255;
41    pub const AT_LEAST_TIMING_VARIANCE: f32 = 1.0;
42}
43
44pub use settings::*;