rustango 0.63.0

Batteries-included web framework for Rust: ORM + migrations + auto-admin + multi-tenancy + audit log + auth (sessions, JWT, OAuth2/OIDC, HMAC) + APIs (ViewSet, OpenAPI auto-derive, JSON:API) + jobs (in-mem + Postgres) + email + media (S3 / R2 / B2 / MinIO + presigned uploads + collections + tags) + production middleware (CSRF, CSP, rate-limiting, compression, idempotency, etc.).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Files only their owner may read, created without following a link.

/// `O_CREAT | O_EXCL`, mode 0600 on Unix: a link or file already at `path`
/// is an error, never opened. Windows has no mode bits here.
///
/// # Errors
/// The open's I/O error; [`std::io::ErrorKind::AlreadyExists`] when
/// anything, a dangling link included, is at `path`.
pub(crate) fn create(path: &std::path::Path) -> std::io::Result<std::fs::File> {
    let mut opts = std::fs::OpenOptions::new();
    opts.write(true).create_new(true);
    #[cfg(unix)]
    std::os::unix::fs::OpenOptionsExt::mode(&mut opts, 0o600);
    opts.open(path)
}