Crate shkeleton

source ·
Expand description

Shkeleton is a skeleton Rust project which defines some default dependencies and contains some common API’s. The idea behind Shkeleton is that you don’t need to update all the dependencies by hand for every your library or binary, you could just update Shkeleton version and get all updates.

Dependencies

  • log - logging facade
  • byteorder - dealing with data reading/writing
  • lazy_static - macro to define a lazy static constants
  • array_tool - utilities for dealing with arrays
  • itertools - utilities for dealing with iterators
  • regex - regular expressions
  • url - handling URLs
  • derive_more & derive_deref - more derive implementations
  • chrono - dealing with time and date

Features

Shkeleton also defines a few features which extend the dependencies list and APIs.

CLI feature

Additional dependencies:

  • clap - define your command line arguments parser
  • sherr - error handling and logger helpers
  • glob - dealing with glob patterns

Concurrency feature

Additional dependencies:

  • scoped-pool - define and use a thread pool
  • num_cpus - get the number of CPUs and cores available
  • parking_lot - faster syncronization primitives Concurrency feature also defines a facade for RwLock, which allowes to hide an implementation (std::sync::RwLock or parking_lot::RwLock) behind this facade and switch implementation without need to update sources. It could be valuable because the parking_lot implementation lacks “lock poisoning” and may be harder to debug deadlocks.

Failure feature

Enables fail feature of the sherr dependency and reexports sherr::failure.

Re-exports

pub extern crate derive_deref;
pub extern crate derive_more;
pub extern crate lazy_static;
pub extern crate sherr;

Modules

A library for acquiring a backtrace at runtime
A lightweight logging facade.

Macros

Logs a message at the debug level.
Logs a message at the error level.
Logs a message at the info level.
The standard logging macro.
Determines if a message logged at the specified level in that module will be logged.
Logs a message at the trace level.
Logs a message at the warn level.

Structs

Metadata about a log message.
The type returned by from_str when the string doesn’t match any of the log levels.
The “payload” of a log message.
Builder for Record.
The type returned by set_logger if set_logger has already been called.

Enums

An enum representing the available verbosity levels of the logger.
An enum representing the available verbosity level filters of the logger.

Constants

The statically resolved maximum log level.

Traits

A trait encapsulating the operations required of a logger.

Functions

Returns a reference to the logger.
Returns the current maximum log level.
Sets the global logger to a &'static Log.
A thread-unsafe version of set_logger.
Sets the global maximum log level.