fs
Module: fs
Section titled “Module: fs”Contents
Section titled “Contents”Enums
CreatePrivateDirError- Error returned by [create_private_dir_all].
Functions
create_private_dir_all- Createpathand all parents with mode 0700 on Unix (umask-independent).write_private_file- Writecontentstopathwith mode 0600 on Unix (owner read/write only, umask-independent).
firma_runtime_state::fs::CreatePrivateDirError
Section titled “firma_runtime_state::fs::CreatePrivateDirError”Enum
Error returned by [create_private_dir_all].
Variants:
Create{ path: std::path::PathBuf, source: io::Error }- Directory creation failed.Chmod{ path: std::path::PathBuf, source: io::Error }- Setting mode 0700 on an existing directory failed.
Trait Implementations:
- Display
fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result
- Error
fn source(self: &Self) -> ::core::option::Option<&dyn ::thiserror::__private18::Error>
- Debug
fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
firma_runtime_state::fs::create_private_dir_all
Section titled “firma_runtime_state::fs::create_private_dir_all”Function
Create path and all parents with mode 0700 on Unix (umask-independent).
Also enforces 0700 on pre-existing directories.
On Windows, falls back to create_dir_all without explicit mode.
Errors
Section titled “Errors”Returns [CreatePrivateDirError::Create] if the directory cannot be created,
or [CreatePrivateDirError::Chmod] if its permissions cannot be set to 0700.
fn create_private_dir_all(path: &std::path::Path) -> Result<(), CreatePrivateDirError>firma_runtime_state::fs::write_private_file
Section titled “firma_runtime_state::fs::write_private_file”Function
Write contents to path with mode 0600 on Unix (owner read/write only, umask-independent).
Uses O_CREAT | O_TRUNC so the mode is set atomically on creation with no write-then-chmod
race. Falls back to [std::fs::write] on non-Unix platforms.
Errors
Section titled “Errors”Returns an [io::Error] on any I/O failure.
fn write_private_file(path: &std::path::Path, contents: &[u8]) -> io::Result<()>