Struct short_url::UrlEncoder[][src]

pub struct UrlEncoder { /* fields omitted */ }

Implementations

Creates a new UrlEncoder decoder/encoder.

use short_url::UrlEncoder;

let encoder = UrlEncoder::new("mn6j2c4rv8bpygw95z7hsdaetxuk3fq", 24);

Encodes a number into a string based on the UrlEncoder

use short_url::UrlEncoder;
let encoder = UrlEncoder::new("mn6j2c4rv8bpygw95z7hsdaetxuk3fq", 24);

assert_eq!(String::from("867nv"), encoder.encode_url(1, 5));

Decodes a string into ausize

 use short_url::UrlEncoder;
 let e = UrlEncoder::new("mn6j2c4rv8bpygw95z7hsdaetxuk3fq", 24);

 assert_eq!(1, e.decode_url("867nv").unwrap());

Errors

This method will error if the provided string is not valid with the alphabet used to construct the UrlEncoder

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.