TextText-based

text/x-rust

Rust Source

Reference for text/x-rust, the MIME type for Rust programming language source code files focused on safety and performance.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .rs

HTTP Content-Type Header

HTTP Header
Content-Type: text/x-rust; charset=utf-8

Associated File Extensions

.rs

Quick Facts

MIME Typetext/x-rust
CategoryText
TypeText-based (human-readable)
Extensions.rs

Common Usage

Rust source files are used for systems programming, WebAssembly, command-line tools, web servers (Actix, Axum), game engines, operating system components, and blockchain. Rust's ownership system guarantees memory safety without a garbage collector.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.rs" type="text/x-rust">

<!-- Or for script/media elements -->
<script type="text/x-rust" src="file.rs"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('text/x-rust');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-rust' });
nginx
# nginx.conf — add to types block or use default
types {
    text/x-rust  rs;
}

# Or set for a specific location
location /api/ {
    default_type text/x-rust;
}

Related MIME Types

More Text MIME Types

Other text types in the Text family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.