Skip to content

Commit

Permalink
fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
magiclen committed May 20, 2022
1 parent 1284869 commit 6b97212
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 340 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crc-any"
version = "2.4.2"
version = "2.4.3"
authors = ["Magic Len <[email protected]>"]
edition = "2021"
repository = "https://github.com/magiclen/crc-any"
Expand Down
105 changes: 35 additions & 70 deletions src/crc_u16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc10();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x199", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x199\", &crc.to_string());")]
/// ```
pub fn crc10() -> CRCu16 {
Self::create_crc(0x0233, 10, 0x0000, 0x0000, false)
Expand All @@ -372,8 +371,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc10cdma2000();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x233", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x233\", &crc.to_string());")]
/// ```
pub fn crc10cdma2000() -> CRCu16 {
Self::create_crc(0x03D9, 10, 0x03FF, 0x0000, false)
Expand All @@ -387,8 +385,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc10gsm();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x12A", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x12A\", &crc.to_string());")]
/// ```
pub fn crc10gsm() -> CRCu16 {
Self::create_crc(0x0175, 10, 0x0000, 0x03FF, false)
Expand All @@ -402,8 +399,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc11();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x5A3", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x5A3\", &crc.to_string());")]
/// ```
pub fn crc11() -> CRCu16 {
Self::create_crc(0x0385, 11, 0x001a, 0x0000, false)
Expand All @@ -417,8 +413,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc12();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xF5B", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xF5B\", &crc.to_string());")]
/// ```
pub fn crc12() -> CRCu16 {
Self::create_crc(0x080F, 12, 0x0000, 0x0000, false)
Expand All @@ -432,8 +427,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc12cdma2000();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xD4D", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD4D\", &crc.to_string());")]
/// ```
pub fn crc12cdma2000() -> CRCu16 {
Self::create_crc(0x0F13, 12, 0x0FFF, 0x0000, false)
Expand All @@ -447,8 +441,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc12gsm();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xB34", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB34\", &crc.to_string());")]
/// ```
pub fn crc12gsm() -> CRCu16 {
Self::create_crc(0x0D31, 12, 0x0000, 0x0FFF, false)
Expand All @@ -462,8 +455,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc13bbc();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x04FA", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x04FA\", &crc.to_string());")]
/// ```
pub fn crc13bbc() -> CRCu16 {
Self::create_crc(0x1CF5, 13, 0x0000, 0x0000, false)
Expand All @@ -477,8 +469,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc14darc();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x082D", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x082D\", &crc.to_string());")]
/// ```
pub fn crc14darc() -> CRCu16 {
Self::create_crc(0x2804, 14, 0x0000, 0x0000, true)
Expand All @@ -492,8 +483,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc14gsm();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x30AE", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x30AE\", &crc.to_string());")]
/// ```
pub fn crc14gsm() -> CRCu16 {
Self::create_crc(0x202D, 14, 0x0000, 0x3FFF, false)
Expand All @@ -507,8 +497,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc15can();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x059E", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x059E\", &crc.to_string());")]
/// ```
pub fn crc15can() -> CRCu16 {
Self::create_crc(0x4599, 15, 0x0000, 0x0000, false)
Expand All @@ -522,8 +511,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc15mpt1327();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x2566", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x2566\", &crc.to_string());")]
/// ```
pub fn crc15mpt1327() -> CRCu16 {
Self::create_crc(0x6815, 15, 0x0000, 0x0001, false)
Expand All @@ -537,8 +525,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xBB3D", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBB3D\", &crc.to_string());")]
/// ```
pub fn crc16() -> CRCu16 {
// Self::create_crc(0xA001, 16, 0x0000, 0x0000, true)
Expand All @@ -555,8 +542,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16ccitt_false();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x29B1", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x29B1\", &crc.to_string());")]
/// ```
pub fn crc16ccitt_false() -> CRCu16 {
// Self::create_crc(0x1021, 16, 0xFFFF, 0x0000, false)
Expand All @@ -573,8 +559,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16aug_ccitt();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xE5CC", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xE5CC\", &crc.to_string());")]
/// ```
pub fn crc16aug_ccitt() -> CRCu16 {
// Self::create_crc(0x1021, 16, 0x1D0F, 0x0000, false)
Expand All @@ -591,8 +576,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16buypass();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xFEE8", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xFEE8\", &crc.to_string());")]
/// ```
pub fn crc16buypass() -> CRCu16 {
// Self::create_crc(0x8005, 16, 0x0000, 0x0000, false)
Expand All @@ -609,8 +593,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16cdma2000();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x4C06", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x4C06\", &crc.to_string());")]
/// ```
pub fn crc16cdma2000() -> CRCu16 {
// Self::create_crc(0xC867, 16, 0xFFFF, 0x0000, false)
Expand All @@ -627,8 +610,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16dds_110();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x9ECF", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x9ECF\", &crc.to_string());")]
/// ```
pub fn crc16dds_110() -> CRCu16 {
// Self::create_crc(0x8005, 16, 0x800D, 0x0000, false)
Expand All @@ -645,8 +627,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16dect_r();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x007E", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x007E\", &crc.to_string());")]
/// ```
pub fn crc16dect_r() -> CRCu16 {
// Self::create_crc(0x0589, 16, 0x0000, 0x0001, false)
Expand All @@ -663,8 +644,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16dect_r();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x007E", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x007E\", &crc.to_string());")]
/// ```
pub fn crc16dect_x() -> CRCu16 {
// Self::create_crc(0x0589, 16, 0x0000, 0x0000, false)
Expand All @@ -681,8 +661,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16dnp();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xEA82", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xEA82\", &crc.to_string());")]
/// ```
pub fn crc16dnp() -> CRCu16 {
// Self::create_crc(0xA6BC, 16, 0x0000, 0xFFFF, true)
Expand All @@ -699,8 +678,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16en_13757();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xC2B7", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xC2B7\", &crc.to_string());")]
/// ```
pub fn crc16en_13757() -> CRCu16 {
// Self::create_crc(0x3D65, 16, 0x0000, 0xFFFF, false)
Expand All @@ -717,8 +695,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16genibus();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xD64E", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD64E\", &crc.to_string());")]
/// ```
pub fn crc16genibus() -> CRCu16 {
// Self::create_crc(0x1021, 16, 0xFFFF, 0xFFFF, false)
Expand All @@ -735,8 +712,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16maxim();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x44C2", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x44C2\", &crc.to_string());")]
/// ```
pub fn crc16maxim() -> CRCu16 {
// Self::create_crc(0xA001, 16, 0x0000, 0xFFFF, true)
Expand All @@ -753,8 +729,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16mcrf4cc();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x6F91", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x6F91\", &crc.to_string());")]
/// ```
pub fn crc16mcrf4cc() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0xFFFF, 0x0000, true)
Expand All @@ -771,8 +746,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16riello();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x63D0", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x63D0\", &crc.to_string());")]
/// ```
pub fn crc16riello() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0xB2AA, 0x0000, true)
Expand All @@ -789,8 +763,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16t10_dif();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xD0DB", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD0DB\", &crc.to_string());")]
/// ```
pub fn crc16t10_dif() -> CRCu16 {
// Self::create_crc(0x8BB7, 16, 0x0000, 0x0000, false)
Expand All @@ -807,8 +780,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16teledisk();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x0FB3", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x0FB3\", &crc.to_string());")]
/// ```
pub fn crc16teledisk() -> CRCu16 {
// Self::create_crc(0xA097, 16, 0x0000, 0x0000, false)
Expand All @@ -825,8 +797,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16tms13157();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x26B1", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x26B1\", &crc.to_string());")]
/// ```
pub fn crc16tms13157() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0x89EC, 0x0000, true)
Expand All @@ -843,8 +814,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16usb();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xB4C8", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB4C8\", &crc.to_string());")]
/// ```
pub fn crc16usb() -> CRCu16 {
// Self::create_crc(0xA001, 16, 0xFFFF, 0xFFFF, true)
Expand All @@ -861,8 +831,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc_a();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0xBF05", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBF05\", &crc.to_string());")]
/// ```
pub fn crc_a() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0xC6C6, 0x0000, true)
Expand All @@ -879,8 +848,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16kermit();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x2189", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x2189\", &crc.to_string());")]
/// ```
pub fn crc16kermit() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0x0000, 0x0000, true)
Expand All @@ -897,8 +865,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16modbus();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x4B37", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x4B37\", &crc.to_string());")]
/// ```
pub fn crc16modbus() -> CRCu16 {
// Self::create_crc(0xA001, 16, 0xFFFF, 0x0000, true)
Expand All @@ -915,8 +882,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16_x25();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x906E", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x906E\", &crc.to_string());")]
/// ```
pub fn crc16_x25() -> CRCu16 {
// Self::create_crc(0x8408, 16, 0xFFFF, 0xFFFF, true)
Expand All @@ -933,8 +899,7 @@ impl CRCu16 {
/// # use crc_any::CRCu16;
/// let mut crc = CRCu16::crc16xmodem();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x31C3", &crc.to_string());
#[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x31C3\", &crc.to_string());")]
/// ```
pub fn crc16xmodem() -> CRCu16 {
// Self::create_crc(0x1021, 16, 0x0000, 0x0000, false)
Expand Down
Loading

0 comments on commit 6b97212

Please sign in to comment.