Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
frakt
High-performance, async-first HTTP client for Rust. Cross-platform with native backends: NSURLSession on Apple platforms, WinHTTP on Windows, and Reqwest elsewhere.
Features
- Async/await with tokio - Full async support, no blocking APIs
- All HTTP methods - GET, POST, PUT, DELETE, PATCH, HEAD
- WebSocket support - NSURLSessionWebSocketTask/WinHTTP integration
- File operations - Uploads/downloads with progress tracking
- Background sessions - Downloads that survive app suspension (iOS)
- Cookie management - NSHTTPCookieStorage/cookie_store integration
- Proxy configuration - HTTP/HTTPS/SOCKS proxy support
- Authentication - Basic, Bearer, and Custom authentication
- TLS/Certificate handling - Server trust challenge support
- Streaming responses - AsyncRead for memory-efficient large downloads
- Multipart form data - File uploads with form fields
- Zero-overhead - Direct objc2 bindings with minimal abstractions
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Platform Support
- macOS 10.15+ (Foundation backend using NSURLSession)
- iOS 13.0+ (Foundation backend using NSURLSession)
- Windows (WinHTTP backend)
- Linux/Unix (Reqwest backend)
- Rust 1.86+
The library automatically selects the best native backend for each platform. You can also manually specify a backend using BackendType if needed.
Quick Start
use Client;
async
Examples
Basic HTTP Requests
// GET request
let response = client.get.send.await?;
// POST with JSON
let response = client
.post
.header
.body
.send
.await?;
Authentication
use Auth;
// Basic authentication
let response = client
.get
.auth
.send
.await?;
// Bearer token
let response = client
.get
.auth
.send
.await?;
File Downloads with Progress
let response = client
.get
.progress
.send
.await?;
// Download directly to file
client
.download
.to_file
.progress
.send
.await?;
WebSocket
use ;
let websocket = client
.websocket
.maximum_message_size
.connect
.await?;
// Send message
websocket.send.await?;
// Receive message
let message = websocket.receive.await?;
match message
// Close connection
websocket.close;
Cookies
let client = builder
.use_cookies
.build?;
// Cookies are automatically managed
let response = client.get.send.await?;
let response = client.get.send.await?; // Cookie sent automatically
Proxy Configuration
let client = builder
.http_proxy
.proxy_auth
.build?;
Streaming Large Responses
use AsyncReadExt;
let response = client.get.send.await?;
let mut stream = response.stream;
let mut buffer = ;
while let bytes_read = stream.read.await?
Available Examples
Run examples with cargo run --example <name>:
auth- Authentication methods (Basic, Bearer, Custom)cookies- Cookie management and automatic handlingdownload- Basic file downloadsfile_download- Direct-to-file downloads with progressfile_upload- File uploads using Body::from_file()multipart- Multipart form data uploadsprogress- Progress tracking for downloadsproxy- Proxy configuration (HTTP/HTTPS/SOCKS)streaming- Streaming large responses with AsyncReadupload_task- Upload tasks with progress trackingwebsocket- WebSocket client usagebackground_download- Background downloads (iOS)
Architecture
This library provides a unified HTTP client interface with platform-native backends. On Apple platforms, it uses direct Rust bindings to NSURLSession via objc2. On Windows, it uses WinHTTP APIs. On other platforms, it uses the battle-tested Reqwest library. Key design principles:
- Async-only: Built for tokio, no blocking APIs
- Zero-overhead: Direct native API calls with minimal abstraction
- Memory efficient: Uses platform-native data types where possible
- Type safe: All unsafe native API calls are wrapped in safe APIs
- Rusty: Builder patterns and ergonomic error handling
Error Handling
All errors are mapped to Rust's Result type:
use Error;
match client.get.send.await
Performance
frakt leverages platform-native performance optimizations:
- HTTP/2 and HTTP/3 support (when available)
- Connection pooling and keep-alive
- Automatic compression (gzip, deflate, br)
- Native TLS implementation
- Background processing capabilities
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.