Crate fdf

Source

Macros§

const_from_env
Macro to create a const from an env var with compile-time parsing (Please read the docs carefully)
cstr
A macro to create a C-style *str pointer from a byte slice(does not allocate!) Returns a pointer to a null-terminated C-style *const _ (type inferred by caller, i8 or u8)
impl_bytes_storage
Macro to implement BytesStorage for types that support From<&[u8]> The types must implement From<&[u8]> to be used with this macro
offset_dirent
A helper macro to safely access dirent(64 on linux)’s fields of a libc::dirent/libc::dirent64 aka ‘dirent-type’ struct by offset.

Structs§

DirEntry
A struct representing a directory entry.
Finder
A struct to find files in a directory.
FinderBuilder
A builder for creating a Finder instance with customisable options.
OsBytes
OsBytes provides a generic wrapper around byte storage types that implement the BytesStorage trait.
SearchConfig
This struct holds the configuration for searching directories.
TempDirent
A temporary directory entry used for filtering purposes. Used to avoid heap allocations.

Enums§

DirEntryError
An error type for directory entry operations.
FileType
Represents the type of a file in the filesystem, tiny enum

Constants§

BUFFER_SIZE
The size of the buffer used for directory entries, set to 4115 by default, but can be customised via environment variable. size of IO block
LOCAL_PATH_MAX
The maximum length of a local path, set to 4096 by default, but can be customised via environment variable.

Traits§

BytePath
a trait over anything which derefs to &[u8] then convert to *const i8 or *const u8 (inferred ), useful for FFI.
BytesStorage
a trait that all storage types must implement (for our main types) (so the user can use their own types if they want)

Functions§

contains_zero_byte
Returns true if x contains any zero byte. COPY PASTED FROM STDLIB INTERNALS.
dirent_const_time_strlen
Const-fn strlen for dirent’s d_name field using bit tricks, no SIMD. Constant time (therefore branchless)
find_zero_byte_u64
Returns the index (0..=7) of the first zero byte** in a u64 word. IT MUST CONTAIN A NULL TERMINATOR
glob_to_regex
Parse a shell glob-like pattern into a regular expression(String)
memrchr
Returns the last index matching the byte x in text. This is directly copy pasted from the internal library with some modifications to make it work for me there were no unstable features so I thought I’ll skip a dependency and add this.
strlen
Calculates the length of a null-terminated string pointed to by ptr, Via specialised instructions, AVX2 if available, then SSE2 then libc’s strlen
unix_time_to_system_time
Convert Unix timestamp (seconds + nanoseconds) to SystemTime Not in use currently, later.

Type Aliases§

DirEntryFilter
generic filter function type for directory entries
FilterType
filter function type for directory entries,
Result
Generic result type for directory entry operations
SlimmerBytes
This is a type alias for a boxed slice of bytes with a slimmer size representation on Linux/macos, 10 bytes not 16