Struct rusqbin::models::Id [] [src]

pub struct Id(_);

Id type for Request Bins. Wraps a String.

JSON encodes to just a plain ol' String (as opposed to an object).

To construct an Id, use an IdExtractor's parse method, or use the static random() method.

let id = Id::random();

let id_extractor = IdExtractor::new();

let parsed_id = {
  let id_as_str = id.value();
  id_extractor.parse(id_as_str)
};

assert_eq!(parsed_id, Some(id));

let nope = id_extractor.parse("lulz");
assert_eq!(nope, None);Run

Methods

impl Id
[src]

Generates a random Id

Gets the value out of an Id.

Trait Implementations

impl PartialEq for Id
[src]

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

This method tests for !=.

impl Debug for Id
[src]

Formats the value using the given formatter.

impl Eq for Id
[src]

impl Hash for Id
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl Clone for Id
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Encodable for Id
[src]

Serialize a value using an Encoder.

impl Decodable for Id
[src]

Deserialize a value using a Decoder.

impl Display for Id
[src]

Formats the value using the given formatter. Read more