Skip to main content

Module utils

Module utils 

Source
Expand description

Utility types and functions for HTTP operations.

This module provides convenient re-exports of commonly used types and utilities that are helpful when working with HTTP requests, responses, and async operations. These re-exports save you from having to import these dependencies directly.

§Exported Types

  • Bytes - Efficient byte buffer for HTTP body data
  • ByteStr - UTF-8 validated byte string for text content
  • All items from futures_lite - Async utilities and traits

§Examples

§Working with Bytes

use http_kit::utils::Bytes;

let data = Bytes::from("Hello, world!");
assert_eq!(data.len(), 13);

§Working with ByteStr

use http_kit::utils::ByteStr;

let text = ByteStr::from_static("Hello, world!");
assert_eq!(text.as_str(), "Hello, world!");

§Async Operations

use http_kit::utils::{AsyncReadExt, AsyncWriteExt};

// Use async I/O traits for streaming operations

Re-exports§

pub use futures_lite::AsyncBufRead;
pub use futures_lite::AsyncBufReadExt;
pub use futures_lite::AsyncRead;
pub use futures_lite::AsyncReadExt;
pub use futures_lite::AsyncSeek;
pub use futures_lite::AsyncSeekExt;
pub use futures_lite::AsyncWrite;
pub use futures_lite::AsyncWriteExt;
pub use futures_lite::Future;
pub use futures_lite::FutureExt;
pub use futures_lite::Stream;
pub use futures_lite::StreamExt;

Modules§

future
Complete async runtime utilities and traits.
io
Complete async runtime utilities and traits.
prelude
Complete async runtime utilities and traits.
stream
Complete async runtime utilities and traits.

Macros§

pin
Complete async runtime utilities and traits.
ready
Complete async runtime utilities and traits.

Structs§

ByteStr
UTF-8 validated byte string optimized for text content.
Bytes
Efficient, reference-counted byte buffer for HTTP body data.