Struct cannyls::lump::LumpId[][src]

pub struct LumpId(_);

Lumpの識別子(128bit幅).

Methods

impl LumpId
[src]

SIZE: usize = 16

識別子のバイト幅.

新しいLumpIdインスタンスを生成する.

Examples

use cannyls::lump::LumpId;

assert_eq!(LumpId::new(0x12_3456).to_string(), "00000000000000000000000000123456");

// 16進数文字列からも生成可能
assert_eq!("123456".parse::<LumpId>().unwrap(), LumpId::new(0x12_3456));

識別子の値(128bit整数)を返す.

Trait Implementations

impl Clone for LumpId
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for LumpId
[src]

impl PartialOrd for LumpId
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for LumpId
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl PartialEq for LumpId
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for LumpId
[src]

impl Hash for LumpId
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for LumpId
[src]

The associated error which can be returned from parsing.

16進数表記の数値からLumpIdを生成する.

数値の"128bit整数"として扱われ、先頭のゼロは省略可能("ab12""00ab12"は等価).

Errors

以下のいずれかの場合には、種類がErrorKind::InvalidInputのエラーが返される:

  • 文字列が16進数表記の整数値を表していない
  • 文字列の長さが32文字を超えている

Examples

use std::str::{self, FromStr};
use cannyls::ErrorKind;
use cannyls::lump::LumpId;

assert_eq!(LumpId::from_str("00ab12").ok(),
           Some(LumpId::new(0xab12)));

assert_eq!(LumpId::from_str("foo_bar").err().map(|e| *e.kind()),
           Some(ErrorKind::InvalidInput));

let large_input = str::from_utf8(&[b'a', 33][..]).unwrap();
assert_eq!(LumpId::from_str(large_input).err().map(|e| *e.kind()),
           Some(ErrorKind::InvalidInput));

impl Debug for LumpId
[src]

Formats the value using the given formatter. Read more

impl Display for LumpId
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for LumpId

impl Sync for LumpId