cib: Copyable-in-Byte (example name)
This crate provides the Cib trait for types that can be viewed as an
integer value and support certain operations for both owned and reference
cases.
There are two representation cases:
- owned value: T (the type itself implements
Cibfor owned) - reference value: &T (the reference also implements
Cib)
Due to coherence and orphan rules in Rust, a derive macro is provided in the
companion crate cib-derive to implement the owned case automatically. The
reference case is implemented generically here in this crate.
The derive macro is necessary for the owned case because attempting to
implement the trait for all T: SomeBound would conflict with implementing
it for &T in the general case.
See the doctest in the root of this crate for an example.#![cfg(feature = "derive")]