Debian Codegraph @

/

debian rust-swrite 0.1.0-1debian librust-swrite-dev debian librust-swrite+default-dev debian librust-swrite+osstring-dev debian librust-swrite-0-dev debian librust-swrite-0+default-dev debian librust-swrite-0+osstring-dev debian librust-swrite-0.1-dev debian librust-swrite-0.1+default-dev debian librust-swrite-0.1+osstring-dev debian librust-swrite-0.1.0-dev debian librust-swrite-0.1.0+default-dev debian librust-swrite-0.1.0+osstring-dev cargo swrite 0.1.0 debianjsonmakefilemarkdownrustrust-c-abishelltoml 16 files · 104 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • cargo, debhelper-compat, libstd-rust-dev, rustc
README (full)

swrite

CI crates.io docs.rs Minimum rustc version

swrite is a tiny Rust crate providing the swrite! and swriteln! macros as infallible alternatives to write! and writeln! for Strings. This is safe because writing to a String never returns Err(_).

The implementation uses the SWrite trait. It is implemented for String. With the osstring feature is enabled, it is also implemented for std::ffi::OsString.

Minimum Supported Rust Version (MSRV):

  • Without the osstring feature (default): 1.30.0
  • With the osstring feature: 1.64.0

Usage

In Cargo.toml:

[dependencies]
swrite = "0.1.0"

In your Rust code:

use swrite::{SWrite, swrite, swriteln};

Examples

Using swrite! and swriteln! with a String:

use swrite::{SWrite, swrite, swriteln};

let mut s = String::new();
swrite!(s, "Hello, {}! ", "world");
swriteln!(s, "The answer is {}.", 42);

println!("{}", s);

Output:

Hello, world! The answer is 42.

License

This project is dual-licensed under Apache 2.0 and MIT licenses.

dir debian/
dir src/
dir tests/
file .cargo_vcs_info.json
file Cargo.toml
file Cargo.toml.orig
file LICENSE-Apache
file LICENSE-MIT
file README.md