Crate sd_id128[][src]

GitHub release (latest by date) Crates.io docs.rs github test buy me a coffee donate@paypal

sd-id128 is a rust wrapper for sd-id128 in the systemd API of libsystemd. sd-id128 is part of the systemd.rs project.

Introduction

Features

This library is developed against the latest version of systemd. Unfortunately not all systems are up to date in that regard. Compatibility can be mastered using features. Each feature is named after the corresponding systemd version. The following features exist currently:

  • 240: Jan 12, 2019
  • 233: Mar 12, 2017

All features are in the default feature set. If required, default-features must be turned off. Features are stacking: if you select feature 240, you will get 233 included.

cargo.toml

default, all features included for newest version of libsystemd:

[dependencies]
sd-id128 = "1.0"

support for version 240+ / with features 233 and 240:

[dependencies]
sd-id128 = {default-features=false, version="1.0", features=["240"]}

support for versions older than 233:

[dependencies]
sd-id128 = {default-features=false, version="1.0"}

Example

use sd_id128::{Case, Format, ID128};
let id128 = ID128::boot_id().unwrap();
println!("The boot id in RFC format is: {}", id128);
println!("The boot id in libsystemd format is: {}",
         id128.to_string_formatted(Format::LibSystemD, Case::Lower));

Structs

ID128

Wrapper for sd-id128 as offered in libsystemd.

Enums

Case

Format of hexadecimal letters during transformation from an ID into text

Error

Errors raised in sd-id128

Format

String formats available during transformation from an ID into text